mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
Issue #21619: Popen objects no longer leave a zombie after exit in the with
statement if the pipe was broken. Patch by Martin Panter.
This commit is contained in:
commit
86ba765705
3 changed files with 24 additions and 4 deletions
|
@ -892,10 +892,12 @@ class Popen(object):
|
|||
self.stdout.close()
|
||||
if self.stderr:
|
||||
self.stderr.close()
|
||||
if self.stdin:
|
||||
self.stdin.close()
|
||||
# Wait for the process to terminate, to avoid zombies.
|
||||
self.wait()
|
||||
try: # Flushing a BufferedWriter may raise an error
|
||||
if self.stdin:
|
||||
self.stdin.close()
|
||||
finally:
|
||||
# Wait for the process to terminate, to avoid zombies.
|
||||
self.wait()
|
||||
|
||||
def __del__(self, _maxsize=sys.maxsize):
|
||||
if not self._child_created:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue