Ignore broken pipe error when printing dictionary
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
All checks were successful
lint/clippy Checking for common mistakes and opportunities for code improvement
build/msvc Build for the target platform: msvc
build/linux Build for the target platform: linux
stdout closing prematurely is normal behaviour, e.g. piping into `head`.
This commit is contained in:
parent
ddc69112bc
commit
72ab8811c3
1 changed files with 6 additions and 3 deletions
|
@ -227,9 +227,12 @@ pub(crate) async fn run(mut ctx: sdk::Context, matches: &ArgMatches) -> Result<(
|
||||||
let lookup = &ctx.lookup;
|
let lookup = &ctx.lookup;
|
||||||
let rows: Vec<_> = lookup.entries().iter().map(TableRow::from).collect();
|
let rows: Vec<_> = lookup.entries().iter().map(TableRow::from).collect();
|
||||||
|
|
||||||
print_stdout(rows.with_title())?;
|
match print_stdout(rows.with_title()) {
|
||||||
|
Ok(_) => Ok(()),
|
||||||
Ok(())
|
// Closing stdout prematurely is normal behavior with things like piping into `head`
|
||||||
|
Err(err) if err.kind() == std::io::ErrorKind::BrokenPipe => Ok(()),
|
||||||
|
Err(err) => Err(err.into()),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
_ => unreachable!(
|
_ => unreachable!(
|
||||||
"clap is configured to require a subcommand, and they're all handled above"
|
"clap is configured to require a subcommand, and they're all handled above"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue