#signal #stdout #println #sigpipe #broken-pipe

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

#1526 in Command line utilities

Download history 15/week @ 2022-11-27 43/week @ 2022-12-04 22/week @ 2022-12-11 31/week @ 2022-12-18 12/week @ 2022-12-25 18/week @ 2023-01-01 25/week @ 2023-01-08 29/week @ 2023-01-15 13/week @ 2023-01-22 29/week @ 2023-01-29 11/week @ 2023-02-05 18/week @ 2023-02-12 31/week @ 2023-02-19 13/week @ 2023-02-26 36/week @ 2023-03-05 37/week @ 2023-03-12

119 downloads per month
Used in 3 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

~38KB