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] cat big | head -1 prints strands-shell: cat: pipe closed; bash prints nothing when the reader exits early #376
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
One strands-shell -c '...' run in the default virtual filesystem:
i=0;while [ $i-lt 3000 ];doecho"line $i line line line line line line line line line line"; i=$((i+1));done> big
cat -n big | head -1
sed s/a/b/ big | head -1
sort big | head -1
Expected Behavior
Same as bash 5.2.15: each pipeline prints its first line and nothing on stderr. The writer is ended quietly when head exits.
Actual Behavior
Each pipeline prints its first line and then an error from the writer:
I saw the same line from cat big big big big, head -2000 big, tail -2000 big, cut -c1-20 big and tr a b < big, each piped into head -1, and from cat /dev/zero | head -c 3. These did not print it: grep line big | head -1, ls -l /bin /usr/bin | head -1, and a while read loop piped into head -1.
It only shows once the writer has more output than the pipe holds. cat big | head -1 with this 170 KB file prints no error.
Additional Context
Found while reviewing #354; not caused by that change. cmd | head is a common way to peek at output, so the extra stderr line shows up often.
Possible Solution
Not investigated. grep already ends quietly in this case, so it may show the shape to follow.
Activity