This repository has been archived by the owner on Sep 14, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ignore errors resulting from printing to stdout.
Fixes BurntSushi/ripgrep#22
- Loading branch information
e3f8631
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BurntSushi I'm new to rust and I couldn't find what's the best way to catch Broken pipe error in rust 1.11 stable. Do I get it right that this change simply ignores the error but the loop continues running? Is there a way to catch pipe error and terminate execution without printing a stack trace? This is for my own rust education.
e3f8631
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right to point out that I was being a little careless here. While this does avoid panicing on a pipe error, it also avoids handling any other kind of error too.
In
xsv
I was a bit more fastidious about this, and handled the pipe error explicitly: https://github.com/BurntSushi/xsv/blob/master/src/main.rs#L122-L125