mirror of
https://github.com/python/cpython.git
synced 2025-09-13 20:27:05 +00:00
Clarify cases when waitpid might not return self.pid.
This commit is contained in:
parent
478c82d30f
commit
b95caff56c
1 changed files with 5 additions and 2 deletions
|
@ -94,6 +94,7 @@ class Popen3:
|
|||
if self.sts < 0:
|
||||
try:
|
||||
pid, sts = os.waitpid(self.pid, os.WNOHANG)
|
||||
# pid will be 0 if self.pid hasn't terminated
|
||||
if pid == self.pid:
|
||||
self.sts = sts
|
||||
except os.error:
|
||||
|
@ -105,7 +106,9 @@ class Popen3:
|
|||
"""Wait for and return the exit status of the child process."""
|
||||
if self.sts < 0:
|
||||
pid, sts = os.waitpid(self.pid, 0)
|
||||
if pid == self.pid:
|
||||
# This used to be a test, but it is believed to be
|
||||
# always true, so I changed it to an assertion - mvl
|
||||
assert pid == self.pid
|
||||
self.sts = sts
|
||||
return self.sts
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue