Piping any command into head panics or errors instead of exiting quietly #106
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
[claude 2026-08-15] Closing the read end of a pipe —
| head,| lessand quit — makes the tool panic. Standard Unix behaviour is to die silently on SIGPIPE.Three different behaviours for the same event, depending on how the command writes stdout:
Cause: the commands that go through
output::emitswallow the write error (let _ = writeln!(...)in src/output.rs:64), so they are already quiet. The ones writingprintln!directly panic, andrefspropagates the io::Error up to theerror:reporter.Note the panic needs output that outlives the reader —
issue list | head -2looks fine only because the whole listing fits the 64KB pipe buffer beforeheadexits. It is the same latent bug.Expected: exiting 0 (or dying by SIGPIPE) with no output, for every command, however it writes.
Suggested fix: one exit path that treats
ErrorKind::BrokenPipeas success, and route the directprintln!sites throughoutput::emitso there is one writer rather than three.Migrated from git-collab issue
8baa9fa8a7ab0ec2b2fbff29fb342c4494221340.Original author: a73x dev@a73x.sh.