Skip to content

Commit

Permalink
main:fix
Browse files Browse the repository at this point in the history
  • Loading branch information
eatmeatball committed Jun 30, 2024
1 parent 178f0d7 commit f9542aa
Show file tree
Hide file tree
Showing 7 changed files with 2,555 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ go.work
.idea
jobConfig.json
tmp
#dist
/dist/
.DS_Store
1 change: 1 addition & 0 deletions actor/dist/assets/AboutView-ba921d1a.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2,482 changes: 2,482 additions & 0 deletions actor/dist/assets/index-f73dbb39.js

Large diffs are not rendered by default.

20 changes: 0 additions & 20 deletions jobmanager/job_reg.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"path"
"slices"
"sync"
"syscall"
"time"
)

Expand Down Expand Up @@ -53,25 +52,6 @@ type jobHandle struct {
cmd *exec.Cmd
}

// RunJob 初始化并执行
func (itself *jobHandle) RunJob() {
itself.confLock.Lock()
defer itself.confLock.Unlock()
if itself.cmd == nil {
job := itself.jobConfig
cmd := exec.Command(job.BinPath, job.Params...)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
cmd.Dir = job.Dir
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
itself.cmd = cmd
} else {
return
}
go itself.jobGuard()
}

func (itself *jobHandle) ForceRunJob() {
itself.jobConfig.Run = true
itself.RunJob()
Expand Down
26 changes: 26 additions & 0 deletions jobmanager/job_run_mac.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//go:build darwin || (openbsd && !mips64)

package jobmanager

import (
"os"
"os/exec"
)

// RunJob 初始化并执行
func (itself *jobHandle) RunJob() {
itself.confLock.Lock()
defer itself.confLock.Unlock()
if itself.cmd == nil {
job := itself.jobConfig
cmd := exec.Command(job.BinPath, job.Params...)
cmd.Dir = job.Dir
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
itself.cmd = cmd
} else {
return
}
go itself.jobGuard()
}
28 changes: 28 additions & 0 deletions jobmanager/job_run_win.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//go:build windows

package jobmanager

import (
"os"
"os/exec"
"syscall"
)

// RunJob 初始化并执行
func (itself *jobHandle) RunJob() {
itself.confLock.Lock()
defer itself.confLock.Unlock()
if itself.cmd == nil {
job := itself.jobConfig
cmd := exec.Command(job.BinPath, job.Params...)
cmd.SysProcAttr = &syscall.SysProcAttr{HideWindow: true}
cmd.Dir = job.Dir
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
itself.cmd = cmd
} else {
return
}
go itself.jobGuard()
}
18 changes: 17 additions & 1 deletion resource/jobConfig.example.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
"config": {
"dashboard": {
"port": 9090
},
"options": {
"outputType": 1,
"outputPath": "tmp",
"maxFailures": 5
}
},
"residentTask": [
Expand All @@ -11,6 +16,11 @@
"params": [
"serve"
],
"options": {
"outputType": 1,
"outputPath": "tmp",
"maxFailures": 5
},
"dir": "/Users/thh/workspace/thh",
"run": true
},
Expand All @@ -22,7 +32,8 @@
],
"options": {
"outputType": 1,
"outputPath": "./tmp"
"outputPath": "./tmp",
"maxFailures": 5
},
"dir": "/Users/thh/workspace/atool",
"run": true
Expand All @@ -35,6 +46,11 @@
"params": [
"now"
],
"options": {
"outputType": 1,
"outputPath": "tmp",
"maxFailures": 5
},
"spec": "* * * * *",
"run": true
}
Expand Down

0 comments on commit f9542aa

Please sign in to comment.