#signal #stdout #println #panic #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

#1355 in Command line utilities

Download history 2490/week @ 2024-07-22 3438/week @ 2024-07-29 3998/week @ 2024-08-05 5156/week @ 2024-08-12 3618/week @ 2024-08-19 4902/week @ 2024-08-26 2917/week @ 2024-09-02 2711/week @ 2024-09-09 2414/week @ 2024-09-16 4910/week @ 2024-09-23 3349/week @ 2024-09-30 3104/week @ 2024-10-07 3253/week @ 2024-10-14 1723/week @ 2024-10-21 3266/week @ 2024-10-28 2379/week @ 2024-11-04

10,745 downloads per month
Used in 7 crates

MIT license

5KB

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

~44KB