-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Piping command output to a process that performs a partial read before closing the pipe, such as `head`, will cause an `EPIPE` to be raised on the next write attempt. The standard `(e)print(ln)!` macros will panic on any errors when writing, including `EPIPE`. One option to handle this is to switch to `write(ln)!`, but this will inject new requirements to handle `Result` where used, which can be onerous. Create wrappers around the print macros to ignore `EPIPE`, and replace calls to the originals with them. Update `main` to ignore any `EPIPE`s returned from `writeln!` calls in subcommands. We deliberately do not make this change to the `auth login/logout` subcommands as these are mutating the config. Failure to notify the user of the changes is fatal. Before: $ oxide system networking switch-port-settings show | head -1 switch0/qsfp0 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:102:10: called `Result::unwrap()` on an `Err` value: JoinError::Panic(Id(15), ...) After: $ oxide system networking switch-port-settings show | head -1 switch0/qsfp0
- Loading branch information
1 parent
040f1b0
commit f472bce
Showing
6 changed files
with
183 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.