- 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:
Gregory P. Smith 2011-05-11 21:42:08 -07:00
parent 4e19e11958
commit 6b65745430
4 changed files with 10 additions and 3 deletions

View file

@ -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):