Skip to content

Commit

Permalink
Revert "os: remove sleep in windows Process.Wait"
Browse files Browse the repository at this point in the history
This reverts CL 145221 (commit 5c35973)

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>
  • Loading branch information
alexbrainman committed Nov 9, 2018
1 parent 03e3fbe commit ff7b245
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/os/exec_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit ff7b245

Please sign in to comment.