]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "os: remove sleep in windows Process.Wait"
authorAlex Brainman <alex.brainman@gmail.com>
Fri, 9 Nov 2018 21:32:45 +0000 (08:32 +1100)
committerAlex Brainman <alex.brainman@gmail.com>
Fri, 9 Nov 2018 23:24:35 +0000 (23:24 +0000)
This reverts CL 145221 (commit 5c359736f8d67338b53c26aaef52139ae8cd0538)

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>
src/os/exec_windows.go

index 86b52f69bf976c4ddd5d09391177d07b9f4f5bfe..38293a0d285f46ed647db4e29450c5b96eca39b0 100644 (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
 }