mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
- 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.
This commit is contained in:
parent
4e19e11958
commit
6b65745430
4 changed files with 10 additions and 3 deletions
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue