dimo414 / bkt

a subprocess caching utility, available as a command line binary and a Rust library.
https://www.bkt.rs
MIT License
241 stars 13 forks source link

BrokenPipe panic when stdout is closed early #13

Closed dimo414 closed 2 years ago

dimo414 commented 2 years ago

Example:

$ bkt -- echo | head -n0
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }', /usr/local/google/home/diamondm/.cargo/registry/src/github.com-1ecc6299db9ec823/bkt-0.3.1/src/main.rs:77:48
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

In more typical use cases (e.g. head -n10) we'll only hit this error with sufficiently large output (IIRC ~60k lines on Linux), since the OS buffers output between processes, but either way bkt shouldn't blow up if its output descriptors close.