Skip to content

Commit

Permalink
Merge pull request #218 from cosmtrek/fix_issue_linux
Browse files Browse the repository at this point in the history
fix no such process issue in linux
  • Loading branch information
xiantang authored Nov 27, 2021
2 parents 53fb783 + a2410be commit 63d09e3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions runner/util_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,16 @@ func (e *Engine) killCmd(cmd *exec.Cmd) (pid int, err error) {
time.Sleep(e.config.Build.KillDelay * time.Millisecond)
}

// https://stackoverflow.com/questions/22470193/why-wont-go-kill-a-child-process-correctly
err = syscall.Kill(-pid, syscall.SIGKILL)

err = killByPid(pid)
if err != nil {
return pid, err
}
// Wait releases any resources associated with the Process.
_, _ = cmd.Process.Wait()
_, err = cmd.Process.Wait()
if err != nil {
return pid, err
}
e.mainDebug("killed process pid %d successed", pid)
return
}

Expand Down

0 comments on commit 63d09e3

Please sign in to comment.