sigpipe

Crates.iosigpipe
lib.rssigpipe
version0.1.3
sourcesrc
created_at2022-02-02 01:57:13.801164
updated_at2022-02-02 02:26:15.786617
descriptionA single function call to reset SIGPIPE and fix `failed printing to stdout`
homepage
repositoryhttps://www.github.com/kurtbuilds/sigpipe
max_upload_size
id525514
size5,940
Kurt Wolf (kurtbuilds)

documentation

README

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.

Commit count: 0

cargo fmt