runtime: reap force killed processes

reap child processes after sending SIGKILL

Fixes #5739

Signed-off-by: Alexandru Matei <alexandru.matei@uipath.com>
This commit is contained in:
Alexandru Matei 2022-11-21 11:53:27 +02:00
parent 8246de821f
commit 92ebe61fea

View File

@ -375,8 +375,19 @@ outer:
if pidRunning {
// Force process to die
if err = syscall.Kill(pid, syscall.SIGKILL); err != nil {
if err == syscall.ESRCH {
logger.WithField("pid", pid).Warnf("process already finished")
return nil
}
return fmt.Errorf("Failed to stop process %v: %s", pid, err)
}
for {
_, err := syscall.Wait4(pid, nil, 0, nil)
if err != syscall.EINTR {
break
}
}
}
return nil