sigpipe
The default Rust runtime panics when println! and family write to a closed
pipe. sigpipe fixes it with a single function call invoked at the start of your program.
Usage
Installation
# Using cargo-edit
cargo add sigpipe
# In your Cargo.toml
[dependencies]
sigpipe = "0.1"
Discussion
There have been several discussions about this issue. See:
- https://github.com/rust-lang/rust/issues/24821
- https://github.com/rust-lang/rust/issues/46016
- https://github.com/rust-lang/rust/issues/62569
Acknowledgments
This library is directly copied from @burntsushi's StackOverflow answer.
I made this library to package the solution, so users don't have to hunt for it online.