1
0
mirror of https://github.com/golang/go synced 2024-11-25 09:57:57 -07:00

os: fix WNOHANG Waitmsg

R=golang-dev, rsc
CC=golang-dev
https://golang.org/cl/4962042
This commit is contained in:
Gustavo Niemeyer 2011-08-29 10:45:37 -04:00 committed by Russ Cox
parent 9ef17990c2
commit 1952eb5010

View File

@ -38,7 +38,8 @@ func (p *Process) Wait(options int) (w *Waitmsg, err Error) {
if e != 0 { if e != 0 {
return nil, NewSyscallError("wait", e) 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 p.done = true
} }
w = new(Waitmsg) w = new(Waitmsg)