Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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.
- Host: GitHub
- URL: https://github.com/kurtbuilds/sigpipe
- Owner: kurtbuilds
- License: mit
- Created: 2022-02-02T01:54:46.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-02-02T02:26:12.000Z (almost 3 years ago)
- Last Synced: 2024-09-14T15:48:00.871Z (about 2 months ago)
- Topics: command-line, rust, sigpipe
- Language: Rust
- Homepage:
- Size: 6.84 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 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.