From: Gustavo Niemeyer Date: Mon, 29 Aug 2011 14:45:37 +0000 (-0400) Subject: os: fix WNOHANG Waitmsg X-Git-Tag: weekly.2011-09-01~37 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=1952eb50107c76b4d13ebaed85c29e927fb51a61;p=gostls13.git os: fix WNOHANG Waitmsg R=golang-dev, rsc CC=golang-dev https://golang.org/cl/4962042 --- diff --git a/src/pkg/os/exec_unix.go b/src/pkg/os/exec_unix.go index 8a4b2e1b80..41e77230ad 100644 --- a/src/pkg/os/exec_unix.go +++ b/src/pkg/os/exec_unix.go @@ -38,7 +38,8 @@ func (p *Process) Wait(options int) (w *Waitmsg, err Error) { if e != 0 { return nil, NewSyscallError("wait", e) } - if options&WSTOPPED == 0 { + // With WNOHANG pid is 0 if child has not exited. + if pid1 != 0 && options&WSTOPPED == 0 { p.done = true } w = new(Waitmsg)