Skip to content

Commit d1bd332

Browse files
committed
os: sleep 5ms after process has exited on windows
Fixes #2866. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/5719047
1 parent 718de6f commit d1bd332

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/pkg/os/exec_windows.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func (p *Process) wait() (ps *ProcessState, err error) {
3333
return nil, NewSyscallError("GetProcessTimes", e)
3434
}
3535
p.done = true
36+
// NOTE(brainman): It seems that sometimes process is not dead
37+
// when WaitForSingleObject returns. But we do not know any
38+
// other way to wait for it. Sleeping for a while seems to do
39+
// the trick sometimes. So we will sleep and smell the roses.
40+
defer time.Sleep(5 * time.Millisecond)
3641
defer p.Release()
3742
return &ProcessState{p.Pid, syscall.WaitStatus{ExitCode: ec}, &u}, nil
3843
}

0 commit comments

Comments
 (0)