Rust sets SIGPIPE to SIG_IGN at startup, so a write to a closed pipe returned EPIPE and println panicked on it. `worklane ls | head -3` printed a panic and a backtrace on stderr instead of three lines, which reads as a real fault and is not what any other tool in a pipeline does. main now restores the default disposition before any output, the same six lines frig carries for the same reason. The cost is that a truncated pipe kills the process with signal 13, so a shell reports 141 rather than 101. That is what head and sort do, and it is now in the README next to the other exit codes. The tests drop the read end rather than racing head for it, over a listing large enough to exceed the 64 KiB a pipe holds, since a smaller one lands entirely in the buffer and proves nothing. A shell pipeline into head is covered too, and the exit codes for a real error and a usage mistake are pinned so the reset cannot quietly change them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
17 lines
316 B
TOML
17 lines
316 B
TOML
[package]
|
|
name = "worklane"
|
|
version = "0.3.1"
|
|
edition = "2024"
|
|
|
|
[dependencies]
|
|
clap = { version = "4", features = ["derive"] }
|
|
anyhow = "1"
|
|
uuid = { version = "1", features = ["v4"] }
|
|
chrono = { version = "0.4", features = ["serde"] }
|
|
libc = "0.2"
|
|
|
|
[dev-dependencies]
|
|
assert_cmd = "2"
|
|
assert_fs = "1"
|
|
tempfile = "3"
|