Skip to content
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

Handle stdout being closed prematurely #32

Open
baodrate opened this issue Mar 30, 2023 · 0 comments
Open

Handle stdout being closed prematurely #32

baodrate opened this issue Mar 30, 2023 · 0 comments

Comments

@baodrate
Copy link

When the stdout stream is closed while huniq is still printing, the program errors out:

$ seq 100000 | huniq | head
1
2
3
4
5
6
7
8
9
10
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', library/std/src/io/stdio.rs:1008:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

This was mentioned before in #26, but I felt like it was worth bringing up again.

It's not a big deal other than being a bit ugly, but since this kind of workflow is common for tools like huniq, it would be nice if this wasn't presented as. see also: Misterio77/flavours#16

The error is already being propagated, so it should be simple to just silently handle std::io::ErrorKind::BrokenPipe explicitly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant