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.
This commit is contained in:
Victor Stinner 2017-08-09 17:44:19 +02:00 committed by GitHub
parent 122081deef
commit 4baca1b0f7
1 changed files with 4 additions and 0 deletions

View File

@ -1568,6 +1568,10 @@ class PtyTests(unittest.TestCase):
self.fail("got %d lines in pipe but expected 2, child output was:\n%s"
% (len(lines), child_output))
os.close(fd)
pid, status = os.waitpid(pid, 0)
self.assertEqual(status, 0)
return lines
def check_input_tty(self, prompt, terminal_input, stdio_encoding=None):