-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent CLI to panic when the pipe is broken, fixes #5 #29
Conversation
Signed-off-by: Julien Nioche <[email protected]>
I'm trying to wrap my head around this...not quite the diff itself which is relatively "clear" (use standard C library's But I'm trying to figure out why this happens, this SO answer is the best explanation I've found so far. TL;DR: it's to do with how ...but it's complicated and it shouldn't be! We write Rust so that we can avoid the horrible pitfalls of C most of the times...using the standard C library directly defeats the purpose of this :) The problem really is that But there is an alternative, use // note that `writeln!()` uses the `std::io::Write` trait which has to be in scope
writeln!(std::io::stdout(), "{}...", whatever); Rust would warn you that In other words replace the Don't know if any of this makes sense :) |
Signed-off-by: Julien Nioche <[email protected]>
Clippy doesn't like it We'll tell it to shut up |
Signed-off-by: Julien Nioche <[email protected]>
Possibly worthy adding a note to the CHANGELOG for this? ### Fixed
- [...]
- prevent CLI to panic when the pipe is broken ([issue #5](https://github.com/jnioche/carbonintensity-api/issues/5)) |
Signed-off-by: Julien Nioche <[email protected]>
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.
🎉
No description provided.