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
A program whose stdout reader exits early prints bend: a short write on a standard stream and exits 1 #1467
line of output for a pipe test
bend: a short write on a standard stream
echo ${pipestatus[@]} (zsh) prints 1 0: the program exits 1 and writes an error to the terminal. bend flood.bend -o flood.js && bun flood.js | head -1 does the same.
Expected
The program stops quietly, as Unix tools do. yes | head -1 writes nothing to stderr: yes is ended by SIGPIPE (status 141). Go does this on purpose: when a write to fd 1 or 2 fails with EPIPE, the program ends by SIGPIPE. #1211 fixed the same problem in bend's own output.
Request: when a write to fd 1 or 2 fails with EPIPE, end the program silently, ideally by SIGPIPE, or at least without the message. Writes to files and sockets keep answering Fail.
This matters for any program whose output is piped into head, less, grep -q or similar.
The file
importBasedefflood(n: Nat) ->IO(Unit):
matchn:
case0n:
IO.print("done")
case1n+p:
IO.bind(Unit, Unit, IO.print("line of output for a pipe test"), _=>flood(p))
defmain() ->IO(Unit):
flood(200000n)
Activity
A closed stdout or stderr reader ends a program by SIGPIPE, not with …
A closed stdout or stderr reader ends a program by SIGPIPE, not with …