1
0
镜像自地址 https://github.com/tuna/tunasync.git 已同步 2025-12-06 06:26:46 +00:00

refactor(worker): use Run instead of Start and Wait

这个提交包含在:
bigeagle
2016-04-24 23:21:03 +08:00
父节点 a6e8e9e2d9
当前提交 9339fba074
共有 6 个文件被更改,包括 58 次插入36 次删除

查看文件

@@ -15,6 +15,8 @@ import (
// it's an alternative to python-sh or go-sh
// TODO: cgroup excution
var errProcessNotStarted = errors.New("Process Not Started")
type cmdJob struct {
cmd *exec.Cmd
workingDir string
@@ -62,11 +64,8 @@ func (c *cmdJob) SetLogFile(logFile *os.File) {
}
func (c *cmdJob) Terminate() error {
if c.cmd == nil {
return nil
}
if c.cmd.Process == nil {
return nil
if c.cmd == nil || c.cmd.Process == nil {
return errProcessNotStarted
}
err := unix.Kill(c.cmd.Process.Pid, syscall.SIGTERM)
if err != nil {