Michael Felt <aixto...@felt.demon.nl> added the comment:
Now consistently - stalled. aixtools@x064:[/home/aixtools/py39-3.9]git diff diff --git a/Lib/test/test_builtin.py b/Lib/test/test_builtin.py index eaada1b504..89c4ebc2bd 100644 --- a/Lib/test/test_builtin.py +++ b/Lib/test/test_builtin.py @@ -1849,26 +1849,40 @@ class PtyTests(unittest.TestCase): if pid == 0: # Child + pid = os.getpid() # get my PID + tty = open("/dev/pts/3", "a") + tty.write("\nI am child - this is my PID:{}".format(pid)) + tty.close() try: # Make sure we don't get stuck if there's a problem - signal.alarm(2) + # signal.alarm(2) os.close(r) with open(w, "w") as wpipe: child(wpipe) except: traceback.print_exc() finally: + tty = open("/dev/pts/3", "a") + tty.write("\nI am child - exiting PID:{}".format(pid)) + tty.close() # We don't want to return to unittest... os._exit(0) # Parent os.close(w) + tty = open("/dev/pts/3", "a") + tty.write("\nI am parent:{} with child:{}".format(os.getpid(), pid)) + tty.write("fd:{} input:{}".format(fd, terminal_input)) + tty.close() os.write(fd, terminal_input) # Get results from the pipe with open(r, "r") as rpipe: lines = [] while True: + tty = open("/dev/pts/3", "a") + tty.write("\nI am parent:{} with lines:{}".format(os.getpid(), lines)) + tty.close() line = rpipe.readline().strip() if line == "": # The other end was closed => the child exited @@ -1895,6 +1909,9 @@ class PtyTests(unittest.TestCase): # Wait until the child process completes before closing the PTY to # prevent sending SIGHUP to the child process. + tty = open("/dev/pts/3", "a") + tty.write("\nI am parent:{} starting wait_process({}, exitcode=0)".format(os.getpid(), pid)) + tty.close() support.wait_process(pid, exitcode=0) # Close the PTY ======== Debug ======== aixtools@x064:[/home/aixtools/py39-3.9]./python -m test test_builtin 0:00:00 Run tests sequentially 0:00:00 [1/1] test_builtin I am child - this is my PID:22544440 I am parent:21954660 with child:22544440fd:6 input:b'quux\r' I am parent:21954660 with lines:[] I am child - exiting PID:22544440 I am parent:21954660 with lines:['stdin.isatty(): True'] I am parent:21954660 with lines:['stdin.isatty(): True', "captured: 'prompt'"] I am parent:21954660 starting wait_process(22544440, exitcode=0) ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40155> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com