serhiy-storchaka · GitHub

Bug report

On illumos/Solaris, os.openpty() leaves the calling process with the new pty as its controlling terminal, despite opening the slave with O_NOCTTY. The ptem STREAMS module that openpty() pushes turns the slave into a terminal, and a session leader without a controlling terminal then acquires it at push time.

This causes the whole pty-based test cluster (test_readline, test_cmd, test_pty, ...) to hang forever under python -m test -jN, because regrtest workers are session leaders: after pty_helper.run_pty's child exits, the controlling-terminal association keeps the slave open, so the master never reaches EOF.

After pushing the STREAMS modules, disown a newly-acquired controlling terminal with TIOCNOTTY (with SIGHUP ignored, since it is sent to the session leader).

Linked PRs

Read the original on github.com ↗