diff options
author | Alex Brainman <alex.brainman@gmail.com> | 2012-03-02 16:35:42 +1100 |
---|---|---|
committer | Alex Brainman <alex.brainman@gmail.com> | 2012-03-02 16:35:42 +1100 |
commit | d1bd332a6730b8246177a9213ea11bbeebcf38c4 (patch) | |
tree | 3a53601cce2eff54bc5adadfd90adef7f157f4ed | |
parent | 718de6f4c64a439a867dd0b8aad05f7da630bf76 (diff) | |
download | go-d1bd332a6730b8246177a9213ea11bbeebcf38c4.tar.gz go-d1bd332a6730b8246177a9213ea11bbeebcf38c4.zip |
os: sleep 5ms after process has exited on windows
Fixes #2866.
R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/5719047
-rw-r--r-- | src/pkg/os/exec_windows.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/pkg/os/exec_windows.go b/src/pkg/os/exec_windows.go index fa58020c03..5beca4a650 100644 --- a/src/pkg/os/exec_windows.go +++ b/src/pkg/os/exec_windows.go @@ -33,6 +33,11 @@ func (p *Process) wait() (ps *ProcessState, err error) { return nil, NewSyscallError("GetProcessTimes", e) } 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() return &ProcessState{p.Pid, syscall.WaitStatus{ExitCode: ec}, &u}, nil } |