-
Notifications
You must be signed in to change notification settings - Fork 19
cli: handle EPIPE for version subcommand #774
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
Conversation
EPIPE handling was added recently via {e}println_nopipe() macros, but
wasn't used for the "version" subcommand. This replaces println()
calls with println_nopipe().
Before:
```
➜ oxide.rs git:(main) ./target/debug/oxide version | head -1
Oxide CLI 0.6.1+20240710.0
➜ oxide.rs git:(main) ./target/debug/oxide version | a
zsh: command not found: a
thread 'tokio-runtime-worker' panicked at library/std/src/io/stdio.rs:1021:9:
failed printing to stdout: Broken pipe (os error 32)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' panicked at cli/src/main.rs:105:10:
called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(9), ...)
➜ oxide.rs git:(main)
```
After:
```
➜ oxide.rs git:(trey/epipe_version) ./target/debug/oxide version | head -1
Oxide CLI 0.6.1+20240710.0
➜ oxide.rs git:(trey/epipe_version) ./target/debug/oxide version | a
zsh: command not found: a
➜ oxide.rs git:(trey/epipe_version)
```
Fixes: #773
Signed-off-by: Trey Aspelund <trey@oxidecomputer.com>
a866fe1 to
1891e12
Compare
|
@wfchandler do we know why you lint pr didn't turn this up? |
ahl
left a comment
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.
Nailed it
|
Yes, but the code exists in that PR and wasn't flagged: https://github.com/oxidecomputer/oxide.rs/blob/wc/enforce-nopipe/cli/src/cmd_version.rs#L30 |
Oh interesting, this seems like a clippy bug. In my testing this only happens in |
More specifically, |
EPIPE handling was added recently via {e}println_nopipe() macros, but wasn't used for the "version" subcommand. This replaces println() calls with println_nopipe().
Before:
After:
Fixes: #773