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] A redirect on if, while or until doesn't apply to the condition (if cmd; then …; fi 2>/dev/null still prints cmd's stderr) #371
I have updated to the latest minor and patch version of Strands Shell (built from main @ dbb6189)
I have checked the documentation and this is not expected behavior
I have searched ./issues and there are no duplicates of my issue
Binding
Rust
Strands Shell Version
dbb6189 (--version prints 0.0.0)
Language Runtime Version
Rust 1.100.0
Operating System
Linux 6.18 (aarch64)
Installation Method
built from source
Steps to Reproduce
strands-shell -c 'if echo cond >&2; then :; fi 2>/dev/null; echo done'
strands-shell -c 'if echo cond; then echo body; fi >/dev/null; echo done'
strands-shell -c 'until echo cond >&2; do :; done 2>/dev/null; echo done'
Expected Behavior
Same as bash: the redirect covers the whole compound command, so each command prints only done.
Actual Behavior
Command
stdout
stderr
1
done
cond
2
cond, done
3
done
cond
The condition's output isn't redirected.
Additional Context
The body is redirected: if true; then echo body >&2; fi 2>/dev/null; echo done prints only done, and in the second command above body doesn't appear. while echo cond >&2; false; do :; done 2>/dev/null behaves like the until case.
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