src: restore stdio on program exit #24260
Record the state of the stdio file descriptors on start-up and restore
This is a reworked version of commit c2c9c0c from May 2018 that was
Apropos the NOLINT comments: cpplint doesn't understand do/while
@refack Good catch. Don't know what went wrong but the commit was missing a chunk. Added now in a squash commit for easier reviewing.
Not a good idea. Constructors run at an ill-defined time. This code should run at a specific time.
@addaleax @evanlucas Do you remember how to trigger the regression? I've actually been unable to find any change in behavior that wasn't a bug; i.e., that wasn't about leaving stdio in non-blocking mode.
referenced this pull request
Nov 29, 2018
This particular commit is causing my program to reliably hang on exit in some cases. I confirmed that it works fine with 12.4.0, and 12.5.0 with this commit reverted. I haven't narrowed this down to a repro case (sorry), but what I see when I strace it is:
Said node program is being launched by a Python 3.7 process with
The SIGTTOU hang on exit occurs when it is run in a tmux, but not when run over ssh without a tty.
update: 12.6.0 is still broken