Repository navigation
test(io): process_run's late stdin reader keeps its stdin under dash - #2225
Merged
Merged
Conversation
Under dash as /bin/sh, an asynchronous list's stdin is /dev/null before its redirections, so `(sleep 0.05; cat) <&0 &` read nothing and the case printed False on every lane. Save stdin in fd 3 before the list starts. Co-authored-by: Claude Opus 5.5 <[email protected]>
Lorenzobattistela
approved these changes
Nov 23, 2026
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.
On Linux with dash as
/bin/sh(Debian, Ubuntu and their derivatives),tests/io/process_run.bendprintslate stdin reader: Falseon every lane: C, JS and the interpreter.The case runs
/bin/sh -c "(sleep 0.05; cat) <&0 & exit 0". POSIX gives an asynchronous list a standard input like/dev/nullbefore its explicit redirections, so under dash<&0duplicates/dev/nullandcatreads nothing. bash, which is macOS's/bin/sh, keeps the real stdin when the list redirects it. Without Bend:This saves stdin in fd 3 before the list starts, and the late reader reads fd 3:
The descendant still holds the stdin pipe after the shell exits, so the case tests the same thing. Both shells print 128000 for the new command. On Linux x86_64 (dash 0.5.12) the test passes on C, JS and the interpreter, 3 runs each, where before it failed every run. I have no Mac to run it on. The new command is plain POSIX sh, and it gives 128000 under bash here as well.