From b95caff56c6bc0b5411eb66de155bf920915e9ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20v=2E=20L=C3=B6wis?= Date: Fri, 24 Mar 2006 08:26:26 +0000 Subject: [PATCH] Clarify cases when waitpid might not return self.pid. --- Lib/popen2.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Lib/popen2.py b/Lib/popen2.py index 1529f7e1aee..67ebd26dd64 100644 --- a/Lib/popen2.py +++ b/Lib/popen2.py @@ -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,8 +106,10 @@ 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: - self.sts = sts + # 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