mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
fix: panic when piping "deno help" or "deno --version" (#22917)
Fixes #22863 --------- Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
parent
fb6348500f
commit
9776a13e33
5 changed files with 21 additions and 1 deletions
|
@ -347,7 +347,8 @@ fn resolve_flags_and_init(
|
|||
if err.kind() == clap::error::ErrorKind::DisplayHelp
|
||||
|| err.kind() == clap::error::ErrorKind::DisplayVersion =>
|
||||
{
|
||||
err.print().unwrap();
|
||||
// Ignore results to avoid BrokenPipe errors.
|
||||
let _ = err.print();
|
||||
std::process::exit(0);
|
||||
}
|
||||
Err(err) => exit_for_error(AnyError::from(err)),
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
{
|
||||
"steps": [{
|
||||
"args": "task help",
|
||||
"output": "help.out"
|
||||
}, {
|
||||
"args": "task version",
|
||||
"output": "version.out"
|
||||
}]
|
||||
}
|
6
tests/specs/cli/help_and_version_broken_pipe/deno.json
Normal file
6
tests/specs/cli/help_and_version_broken_pipe/deno.json
Normal file
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"tasks": {
|
||||
"help": "deno help | echo",
|
||||
"version": "deno --version | echo"
|
||||
}
|
||||
}
|
2
tests/specs/cli/help_and_version_broken_pipe/help.out
Normal file
2
tests/specs/cli/help_and_version_broken_pipe/help.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
Task help deno help | echo
|
||||
|
2
tests/specs/cli/help_and_version_broken_pipe/version.out
Normal file
2
tests/specs/cli/help_and_version_broken_pipe/version.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
Task version deno --version | echo
|
||||
|
Loading…
Reference in a new issue