Merged
Conversation
Our tests use subprocesses created by Proc::Simple and calling setsid() so they have no controlling terminals. This means opening /dev/tty doesn't work in test-running subprocesses. The parent process is still controlled by its invoking terminal (if any). If opening /dev/tty fails, 'open($tty,"+</dev/tty")' still makes $tty into a typeglob, causing us to try to close it. This means that using "runtests.pl --promptOnErrorBeforeTearDown" and hitting an error causes a prompt to be issued (in the log file only), and after the user hits return, a close() is attempted on an object that isn't a file handle, causing a fatal error, and the test exits without cleaning up. So we need to rework the I/O device handling. We retain the preference for a controlling terminal (now also falling back to ttyname(0)) over a non-terminal STDERR. If stderr isn't a terminal, look at stdin and see if it is. If so, figure out its device name and open that, with O_NOCTTY so that we don't start catching ^C signals that we want only the parent process to catch. If we open a terminal output device, let's also write the messages into the log file. Co-authored-by: aider (gpt-5) <aider@aider.chat>
lorelei-sakai
approved these changes
Jan 28, 2026
Member
lorelei-sakai
left a comment
There was a problem hiding this comment.
Yeah, I don't really understand this, but I'm not sure anyone else would, either.
If this seems to do what you want, then it's fine.
I have one comment, but it's minor, feel free to resolve it you don't want to do anything with it.
| # Fall back to the device backing STDIN without acquiring a controlling | ||
| # tty. | ||
| my $stdin_path = eval { ttyname(fileno(STDIN)) }; | ||
| if ($stdin_path && |
Member
There was a problem hiding this comment.
Why wrap this? It feels short.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our tests use subprocesses created by Proc::Simple and calling setsid() so they have no controlling terminals. This means opening /dev/tty doesn't work in test-running subprocesses. The parent process is still controlled by its invoking terminal (if any). If opening /dev/tty fails, 'open($tty,"+</dev/tty")' still makes $tty into a typeglob, causing us to try to close it.
So we need to rework the I/O device handling. We retain the preference for a controlling terminal (now also falling back to ttyname(0)) over a non-terminal STDERR.
If stderr isn't a terminal, look at stdin and see if it is. If so, figure out its device name and open that, with O_NOCTTY so that we don't start catching ^C signals that we want only the parent process to catch.
If we open a terminal output device, let's also write the messages into the log file.