This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Michael.Felt
Recipients BTaskaya, Michael.Felt, vstinner
Date 2020-04-02.14:13:16
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1585836796.91.0.608779787232.issue40155@roundup.psfhosted.org>
In-reply-to
Content
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)
History
Date User Action Args
2020-04-02 14:13:16Michael.Feltsetrecipients: + Michael.Felt, vstinner, BTaskaya
2020-04-02 14:13:16Michael.Feltsetmessageid: <1585836796.91.0.608779787232.issue40155@roundup.psfhosted.org>
2020-04-02 14:13:16Michael.Feltlinkissue40155 messages
2020-04-02 14:13:16Michael.Feltcreate