diff --git a/src/os/exec_windows.go b/src/os/exec_windows.go index 86b52f69bf976..38293a0d285f4 100644 --- a/src/os/exec_windows.go +++ b/src/os/exec_windows.go @@ -35,6 +35,12 @@ func (p *Process) wait() (ps *ProcessState, err error) { return nil, NewSyscallError("GetProcessTimes", e) } p.setDone() + // NOTE(brainman): It seems that sometimes process is not dead + // when WaitForSingleObject returns. But we do not know any + // other way to wait for it. Sleeping for a while seems to do + // the trick sometimes. + // See https://golang.org/issue/25965 for details. + defer time.Sleep(5 * time.Millisecond) defer p.Release() return &ProcessState{p.Pid, syscall.WaitStatus{ExitCode: ec}, &u}, nil }