1
0
mirror of https://github.com/golang/go synced 2024-09-25 09:20:18 -06:00

Revert "os: remove sleep in windows Process.Wait"

This reverts CL 145221 (commit 5c359736f8)

Reason for revert: breaks the build occasionally.

Updates #23171
Updates #25965

Change-Id: Ie1e3c76ab9bcd8d28b6118440b5f80c76f9b1852
Reviewed-on: https://go-review.googlesource.com/c/148957
Run-TryBot: Alex Brainman <alex.brainman@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Alex Brainman 2018-11-10 08:32:45 +11:00
parent 03e3fbe421
commit ff7b245a31

View File

@ -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
}