summaryrefslogtreecommitdiff
path: root/Lib/subprocess.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2011-05-11 21:42:08 -0700
committerGregory P. Smith <greg@krypto.org>2011-05-11 21:42:08 -0700
commit683fcdfbf5201d9127727caca60d3a11de0462ce (patch)
tree2f0169c039d7c8807f7531590e4ffd36c97534e2 /Lib/subprocess.py
parentdbb93ebc8bab963fbe6e297c20dc35603555e254 (diff)
downloadcpython-683fcdfbf5201d9127727caca60d3a11de0462ce.tar.gz
- 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 a7c68a5d6e..cd8aa6bc56 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: