You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] stderr written inside $( ) is dropped (x=$(ls /missing) prints no error) #370
Same as bash: a command substitution captures stdout only, so stderr still reaches the shell's stderr.
Command
stdout
stderr
1
rc=2
ls: cannot access '/nonexistent-dir': No such file or directory
2
rc=127
bash: line 1: nosuchcmd: command not found
3
x=out
err
Actual Behavior
stdout matches bash in all three, and stderr is empty in all three.
Additional Context
Outside a substitution the message is printed: ls /nonexistent-dir writes the same error to stderr.
A caller that runs out=$(cmd) and sees a non-zero status gets no message saying why.
Found while reviewing #348; it is not caused by that PR. The results are the same on main @ dbb6189 and on #348's head 9ef3e56. I ran debug builds through -c only and compared with bash 5.2.15.
Activity