-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
178f0d7
commit f9542aa
Showing
7 changed files
with
2,555 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,5 +23,5 @@ go.work | |
.idea | ||
jobConfig.json | ||
tmp | ||
#dist | ||
/dist/ | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters