3 releases
0.1.3 | Feb 2, 2022 |
---|---|
0.1.2 | Feb 2, 2022 |
0.1.1 | Feb 2, 2022 |
#1431 in Command line utilities
13,351 downloads per month
Used in 7 crates
4KB
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
fn main() {
sigpipe::reset();
// The rest of your program goes here.
}
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.
Dependencies
~43KB