summaryrefslogtreecommitdiffstats
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2011-05-12 04:42:08 (GMT)
committerGregory P. Smith <greg@krypto.org>2011-05-12 04:42:08 (GMT)
commit6b65745430245937c7ee088cffa22a2d419396e2 (patch)
tree975201beeeb96eb54b9c8fcc47468ea33ddb3db8 /Lib/subprocess.py
parent4e19e1195817891fdc4ce4c3f0eddde845bf3214 (diff)
downloadcpython-6b65745430245937c7ee088cffa22a2d419396e2.zip
cpython-6b65745430245937c7ee088cffa22a2d419396e2.tar.gz
cpython-6b65745430245937c7ee088cffa22a2d419396e2.tar.bz2
- Issue #12044: Fixed subprocess.Popen when used as a context manager to
wait for the process to end when exiting the context to avoid unintentionally leaving zombie processes around.
Diffstat (limited to 'Lib/subprocess.py')
-rw-r--r--Lib/subprocess.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/subprocess.py b/Lib/subprocess.py
index a7c68a5..cd8aa6b 100644
--- a/Lib/subprocess.py
+++ b/Lib/subprocess.py
@@ -796,6 +796,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: