summaryrefslogtreecommitdiffstats
path: root/Lib/popen2.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-06-02 19:12:01 (GMT)
committerGuido van Rossum <guido@python.org>2003-06-02 19:12:01 (GMT)
commit3800ef7ae2391e3bf6573b41fc6ac513cd3dde82 (patch)
tree1a26e045b819651a01267635bf9ec2bff8667be7 /Lib/popen2.py
parentbf68c78a6fc00de1682428eef4488d757dd2f17b (diff)
downloadcpython-3800ef7ae2391e3bf6573b41fc6ac513cd3dde82.zip
cpython-3800ef7ae2391e3bf6573b41fc6ac513cd3dde82.tar.gz
cpython-3800ef7ae2391e3bf6573b41fc6ac513cd3dde82.tar.bz2
When a previous call to poll() has already seen the process status,
wait() should not call waitpid() again. Should be backported to 2.2.4.
Diffstat (limited to 'Lib/popen2.py')
-rw-r--r--Lib/popen2.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/Lib/popen2.py b/Lib/popen2.py
index d6ff002..8a17641 100644
--- a/Lib/popen2.py
+++ b/Lib/popen2.py
@@ -83,10 +83,11 @@ class Popen3:
def wait(self):
"""Wait for and return the exit status of the child process."""
- pid, sts = os.waitpid(self.pid, 0)
- if pid == self.pid:
- self.sts = sts
- _active.remove(self)
+ if self.sts < 0:
+ pid, sts = os.waitpid(self.pid, 0)
+ if pid == self.pid:
+ self.sts = sts
+ _active.remove(self)
return self.sts