From 7472d94dbcef8aae5d609f448adcd0b295fdcf14 Mon Sep 17 00:00:00 2001 From: Ivan Krutov Date: Sun, 22 Jul 2018 16:37:52 +0300 Subject: [PATCH] Waiting for driver process to stop on Windows (fixes #499) --- service/driver.go | 2 +- service/driver_windows.go | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/service/driver.go b/service/driver.go index 272fc5ff..096fd557 100644 --- a/service/driver.go +++ b/service/driver.go @@ -88,7 +88,7 @@ func (d *Driver) stopProcess(cmd *exec.Cmd) { log.Printf("[%d] [FAILED_TO_TERMINATE_PROCESS] [%d] [%v]", d.RequestId, cmd.Process.Pid, err) return } - if d.CaptureDriverLogs && d.LogOutputDir != "" { + if !d.CaptureDriverLogs && d.LogOutputDir != "" { cmd.Stdout.(*os.File).Close() } log.Printf("[%d] [TERMINATED_PROCESS] [%d] [%.2fs]", d.RequestId, cmd.Process.Pid, util.SecondsSince(s)) diff --git a/service/driver_windows.go b/service/driver_windows.go index 475bf4c9..cff64adb 100644 --- a/service/driver_windows.go +++ b/service/driver_windows.go @@ -7,5 +7,7 @@ import ( ) func stopProc(cmd *exec.Cmd) error { - return cmd.Process.Kill() + error := cmd.Process.Kill() + cmd.Wait() + return error }