mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00: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
|
@ -1590,7 +1590,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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue