Skip to content

Commit 400d97b

Browse files
mpfz0rMarius Sturm
authored and
Marius Sturm
committed
Improve process shutdown (#325)
r.cmd.Process is not updated if the process terminates. Use r.Running instead. Also there is no point to sleep 2 seconds on windows, if we did not send a HUP.
1 parent 861b0c8 commit 400d97b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

daemon/exec_runner.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -236,11 +236,11 @@ func (r *ExecRunner) stop() error {
236236
// give the chance to cleanup resources
237237
if r.cmd.Process != nil && runtime.GOOS != "windows" {
238238
r.cmd.Process.Signal(syscall.SIGHUP)
239+
time.Sleep(2 * time.Second)
239240
}
240-
time.Sleep(2 * time.Second)
241241

242242
// in doubt kill the process
243-
if r.cmd.Process != nil {
243+
if r.Running() {
244244
log.Debugf("[%s] SIGHUP ignored, killing process", r.Name())
245245
err := r.cmd.Process.Kill()
246246
if err != nil {

0 commit comments

Comments
 (0)