From a2410be0276b6e9e74585761c721f34e56328b72 Mon Sep 17 00:00:00 2001 From: xiantang Date: Sat, 27 Nov 2021 13:48:03 +0800 Subject: [PATCH] fix no such process issue in linux --- runner/util_linux.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/runner/util_linux.go b/runner/util_linux.go index 7c3943e2..950ccfc9 100644 --- a/runner/util_linux.go +++ b/runner/util_linux.go @@ -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 }