Commit 4baca1b0 authored by Victor Stinner's avatar Victor Stinner Committed by GitHub

bpo-31160: Fix test_builtin for zombie process (#3043)

PtyTests.run_child() now calls os.waitpid() to read the exit status
of the child process to avoid creating zombie process and leaking
processes in the background.
parent 122081de
...@@ -1568,6 +1568,10 @@ class PtyTests(unittest.TestCase): ...@@ -1568,6 +1568,10 @@ class PtyTests(unittest.TestCase):
self.fail("got %d lines in pipe but expected 2, child output was:\n%s" self.fail("got %d lines in pipe but expected 2, child output was:\n%s"
% (len(lines), child_output)) % (len(lines), child_output))
os.close(fd) os.close(fd)
pid, status = os.waitpid(pid, 0)
self.assertEqual(status, 0)
return lines return lines
def check_input_tty(self, prompt, terminal_input, stdio_encoding=None): def check_input_tty(self, prompt, terminal_input, stdio_encoding=None):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment