From f5010ecb13e740523cbe8dbe175d3f07febad8af Mon Sep 17 00:00:00 2001 From: wsnotify <50022872+wsnotify@users.noreply.github.com> Date: Sun, 9 Feb 2020 18:55:04 +0300 Subject: [PATCH] cmd.Process.Wait (#46) --- runner/util_linux.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/runner/util_linux.go b/runner/util_linux.go index 4968c2fd..5cefe2a1 100644 --- a/runner/util_linux.go +++ b/runner/util_linux.go @@ -11,7 +11,11 @@ import ( func killCmd(cmd *exec.Cmd) (int, error) { pid := cmd.Process.Pid // https://stackoverflow.com/questions/22470193/why-wont-go-kill-a-child-process-correctly - err := syscall.Kill(-cmd.Process.Pid, syscall.SIGKILL) + err := syscall.Kill(-pid, syscall.SIGKILL) + + // Wait releases any resources associated with the Process. + _, _ = cmd.Process.Wait() + return pid, err }