summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_builtin.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2017-08-09 15:44:19 (GMT)
committerGitHub <noreply@github.com>2017-08-09 15:44:19 (GMT)
commit4baca1b0f7325032598cd38e7ceffc79b616d255 (patch)
tree66687ca7d5e3dcf9c63264a54dff36973ee58179 /Lib/test/test_builtin.py
parent122081deef86174beee965be1207fa46ea23533d (diff)
downloadcpython-4baca1b0f7325032598cd38e7ceffc79b616d255.zip
cpython-4baca1b0f7325032598cd38e7ceffc79b616d255.tar.gz
cpython-4baca1b0f7325032598cd38e7ceffc79b616d255.tar.bz2
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.
Diffstat (limited to 'Lib/test/test_builtin.py')
-rw-r--r--Lib/test/test_builtin.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py
index a83d20f..219a08a 100644
--- a/Lib/test/test_builtin.py
+++ b/Lib/test/test_builtin.py
@@ -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):