diff --git a/doc/hyperfine.1 b/doc/hyperfine.1 index 449b470f2..be155f8ee 100644 --- a/doc/hyperfine.1 +++ b/doc/hyperfine.1 @@ -207,9 +207,10 @@ things like "sleep 0.1; sleep 0.2" are not possible without a shell. .IP An alias for '\-\-shell=none'. .HP -\fB\-i\fR, \fB\-\-ignore\-failure\fR +\fB\-i\fR, \fB\-\-ignore\-exit\-code\fR, \fB\-\-ignore\-failure\fR .IP -Ignore non\-zero exit codes of the benchmarked programs. +Ignore non\-zero exit codes of the benchmarked programs. \fB\-\-ignore\-exit\-code\fR is an alias for +\fB\-\-ignore\-failure\fR. .HP \fB\-\-style\fR \fITYPE\fP .IP diff --git a/src/benchmark/executor.rs b/src/benchmark/executor.rs index 915b735b6..3b6dd5b20 100644 --- a/src/benchmark/executor.rs +++ b/src/benchmark/executor.rs @@ -105,7 +105,7 @@ fn run_command_and_measure_common( BenchmarkIteration::Benchmark(i) => format!("benchmark iteration {i}"), }; bail!( - "{cause} in {when}. Use the '-i'/'--ignore-failure' option if you want to ignore this. \ + "{cause} in {when}. Use the '-i'/'--ignore-exit-code'/'--ignore-failure' option if you want to ignore this. \ Alternatively, use the '--show-output' option to debug what went wrong.", cause=result.status.code().map_or( "The process has been terminated by a signal".into(), diff --git a/src/cli.rs b/src/cli.rs index b12f6d34c..c9e09b8c2 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -226,15 +226,17 @@ fn build_command() -> Command { .arg( Arg::new("ignore-failure") .long("ignore-failure") + .alias("ignore-exit-code") .action(ArgAction::Set) .value_name("MODE") .num_args(0..=1) .default_missing_value("all-non-zero") .require_equals(true) .short('i') - .help("Ignore failures of the benchmarked programs. Without a value or with \ + .help("Ignore non-zero exit codes of the benchmarked programs. Without a value or with \ 'all-non-zero', all non-zero exit codes are ignored. You can also provide \ - a comma-separated list of exit codes to ignore (e.g., --ignore-failure=1,2)."), + a comma-separated list of exit codes to ignore (e.g., --ignore-exit-code=1,2). \ + '--ignore-exit-code' is an alias for '--ignore-failure'."), ) .arg( Arg::new("style") diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 2de3a5049..87cf29f93 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -258,6 +258,24 @@ fn fails_for_unknown_conclude_command() { )); } +#[cfg(unix)] +#[test] +fn ignore_exit_code_is_an_alias_for_ignore_failure() { + hyperfine() + .arg("--runs=1") + .arg("--ignore-exit-code") + .arg("false") + .assert() + .success(); + + hyperfine() + .arg("--runs=1") + .arg("--ignore-exit-code=1") + .arg("exit 1") + .assert() + .success(); +} + #[cfg(unix)] #[test] fn can_run_failing_commands_with_ignore_failure_option() {