mirror of
https://github.com/sharkdp/hyperfine.git
synced 2026-10-31 08:40:18 +00:00
Better error handling in run_intermediate_command
This commit is contained in:
1 parent
662d5ca9ac
commit
8c5ae87ca2
2 files changed
+41
-7
No files matched your search
@@ -24,7 +24,7 @@ use crate::util::exit_code::extract_exit_code;
|
||||
use crate::util::min_max::{max, min};
|
||||
use crate::util::units::Second;
|
||||
|
||||
use anyhow::{bail, Result};
|
||||
use anyhow::{anyhow, bail, Result};
|
||||
|
||||
/////////////// TODO: refactor the following part
|
||||
|
||||
@@ -241,17 +241,15 @@ impl<'a> Scheduler<'a> {
|
||||
command: &Command<'_>,
|
||||
error_output: &'static str,
|
||||
) -> Result<TimingResult> {
|
||||
let res = time_shell_command(
|
||||
time_shell_command(
|
||||
&self.options.shell,
|
||||
command,
|
||||
self.options.command_output_policy,
|
||||
CmdFailureAction::RaiseError,
|
||||
None,
|
||||
);
|
||||
if res.is_err() {
|
||||
bail!(error_output);
|
||||
}
|
||||
return res.map(|r| r.0);
|
||||
)
|
||||
.map(|r| r.0)
|
||||
.map_err(|_| anyhow!(error_output))
|
||||
}
|
||||
|
||||
/// Run the command specified by `--setup`.
|
||||
|
||||
Reference in new issue
Block a user