Skip to content

Commit ff4ef99

Browse files
committed
Stop test_builtin from hanging on AIX, Solaris and maybe others.
This is to workaround a side-effect introduced by 16d7567 bpo-31160: Fix race condition in test_os.PtyTests (pythonGH-19263) Patch by M. Felt
1 parent 8ec7cb5 commit ff4ef99

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

Lib/test/test_builtin.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,12 +1893,18 @@ def run_child(self, child, terminal_input):
18931893
self.fail("got %d lines in pipe but expected 2, child output was:\n%s"
18941894
% (len(lines), child_output))
18951895

1896-
# Wait until the child process completes before closing the PTY to
1897-
# prevent sending SIGHUP to the child process.
1898-
support.wait_process(pid, exitcode=0)
1896+
if sys.platform == "linux" or not os.name == "posix":
1897+
# Wait until the child process completes before closing the PTY to
1898+
# prevent sending SIGHUP to the child process.
1899+
support.wait_process(pid, exitcode=0)
18991900

1900-
# Close the PTY
1901-
os.close(fd)
1901+
# Close the PTY
1902+
os.close(fd)
1903+
else:
1904+
# Other posix need to close the pty for the child to exit normally
1905+
# Close the PTY
1906+
os.close(fd)
1907+
support.wait_process(pid, exitcode=0)
19021908

19031909
return lines
19041910

0 commit comments

Comments
 (0)