sigpipe

A single function call to reset SIGPIPE and fix failed printing to stdout

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

Download history 2918/week @ 2024-06-19 2269/week @ 2024-06-26 1991/week @ 2024-07-03 3407/week @ 2024-07-10 3319/week @ 2024-07-17 2452/week @ 2024-07-24 3717/week @ 2024-07-31 4182/week @ 2024-08-07 4793/week @ 2024-08-14 4346/week @ 2024-08-21 3954/week @ 2024-08-28 2809/week @ 2024-09-04 2847/week @ 2024-09-11 3089/week @ 2024-09-18 4599/week @ 2024-09-25 2519/week @ 2024-10-02

13,351 downloads per month
Used in 7 crates

MIT license

4KB

GitHub Contributors Stars Build Status Downloads Crates.io

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:

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