Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kurtbuilds/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.
https://github.com/kurtbuilds/sigpipe

command-line rust sigpipe

Last synced: 25 days ago
JSON representation

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.

Awesome Lists containing this project

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

```rust

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:

- https://github.com/rust-lang/rust/issues/24821
- https://github.com/rust-lang/rust/issues/46016
- https://github.com/rust-lang/rust/issues/62569

# Acknowledgments

This library is directly copied from @burntsushi's
[StackOverflow answer](https://stackoverflow.com/questions/65755853/simple-word-count-rust-program-outputs-valid-stdout-but-panicks-when-piped-to-he/65760807#65760807).

I made this library to package the solution, so users don't have to hunt for it online.