Commit d1bd332a authored by Alex Brainman's avatar Alex Brainman

os: sleep 5ms after process has exited on windows

Fixes #2866.

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5719047
parent 718de6f4
...@@ -33,6 +33,11 @@ func (p *Process) wait() (ps *ProcessState, err error) { ...@@ -33,6 +33,11 @@ func (p *Process) wait() (ps *ProcessState, err error) {
return nil, NewSyscallError("GetProcessTimes", e) return nil, NewSyscallError("GetProcessTimes", e)
} }
p.done = true p.done = true
// 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. So we will sleep and smell the roses.
defer time.Sleep(5 * time.Millisecond)
defer p.Release() defer p.Release()
return &ProcessState{p.Pid, syscall.WaitStatus{ExitCode: ec}, &u}, nil return &ProcessState{p.Pid, syscall.WaitStatus{ExitCode: ec}, &u}, nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment