#stdout #broken-pipe #println #signal

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

#1818 in Command line utilities

Download history 5203/week @ 2025-09-13 4624/week @ 2025-09-20 4538/week @ 2025-09-27 4044/week @ 2025-10-04 4534/week @ 2025-10-11 4599/week @ 2025-10-18 4921/week @ 2025-10-25 4488/week @ 2025-11-01 4066/week @ 2025-11-08 4107/week @ 2025-11-15 3060/week @ 2025-11-22 4460/week @ 2025-11-29 4850/week @ 2025-12-06 5092/week @ 2025-12-13 2536/week @ 2025-12-20 2798/week @ 2025-12-27

16,198 downloads per month
Used in 12 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

~43KB