hive-forge: die by SIGPIPE like every other CLI in a pipeline
Rust's runtime sets SIGPIPE to SIG_IGN at startup, so writing to a pipe whose reader has gone away returns EPIPE and println! panics. `hive-forge <verb> | head` printed a panic and exited 101 where cat, grep and every other pipeline member exit quietly. 101 is not cosmetic: to a caller running `set -o pipefail` it is a real failure, so a shell script that pipes our output stops on a condition that is not an error. Restore SIG_DFL first thing in main, before any output. Measured against the same command: piped to head, 141 (killed by the signal) with empty stderr; unpiped, 0; the pre-change binary, 101 with a panic. Closes #3972
This commit is contained in:
parent
f293454df9
commit
e0c2f1aeaa
3 changed files with 25 additions and 0 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1740,6 +1740,7 @@ dependencies = [
|
|||
"anyhow",
|
||||
"clap",
|
||||
"forgejo-api",
|
||||
"libc",
|
||||
"reqwest",
|
||||
"serde",
|
||||
"serde_json",
|
||||
|
|
|
|||
Loading…
Reference in a new issue