summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2011-05-12 05:18:23 (GMT)
committerGregory P. Smith <greg@krypto.org>2011-05-12 05:18:23 (GMT)
commitc9557af441a2030767cb19bbaba06f57905f41fb (patch)
tree1142600cdb9c213b9171c9bd8ed5e059e3d24da9 /Lib
parent79a11e71c69b3862fc930a47bd628e481685f93b (diff)
downloadcpython-c9557af441a2030767cb19bbaba06f57905f41fb.zip
cpython-c9557af441a2030767cb19bbaba06f57905f41fb.tar.gz
cpython-c9557af441a2030767cb19bbaba06f57905f41fb.tar.bz2
merge - 7a3f3ad83676 Fixes Issue #12044.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/subprocess.py2
-rw-r--r--Lib/test/test_subprocess.py3
2 files changed, 4 insertions, 1 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index 9856e6a..a5381da 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -764,6 +764,8 @@ class Popen(object):
self.stderr.close()
if self.stdin:
self.stdin.close()
+ # Wait for the process to terminate, to avoid zombies.
+ self.wait()
def __del__(self, _maxsize=sys.maxsize, _active=_active):
if not self._child_created:
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 4ec754c..176ff10 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -1491,7 +1491,8 @@ class ContextManagerTests(ProcessTestCase):
def test_returncode(self):
with subprocess.Popen([sys.executable, "-c",
"import sys; sys.exit(100)"]) as proc:
- proc.wait()
+ pass
+ # __exit__ calls wait(), so the returncode should be set
self.assertEqual(proc.returncode, 100)
def test_communicate_stdin(self):