diff --git a/benchmarking/src/time_bench.rs b/benchmarking/src/time_bench.rs index c1472a7c..4e97afdd 100644 --- a/benchmarking/src/time_bench.rs +++ b/benchmarking/src/time_bench.rs @@ -126,7 +126,6 @@ struct RawRunMeasurement { self_usage: Usage, timed_out: bool, status: Option, - signal: Option, } fn time_val_to_duration(time: TimeVal) -> Duration { @@ -174,10 +173,6 @@ impl Time { WaitStatus::Exited(_, status) => Some(status), _ => None, }; - let signal = match wstatus { - WaitStatus::Signaled(_, signal, _) => Some(signal), - _ => None, - }; let real_time = start.elapsed(); let timed_out = *timeout.lock().unwrap(); let usage = getrusage(UsageWho::RUSAGE_CHILDREN)?; @@ -188,7 +183,6 @@ impl Time { self_usage, timed_out, status, - signal, }; Ok(measurement) } @@ -214,9 +208,6 @@ impl Time { // to match behavior of `timeout(1)` return Ok(ExitCode::from(124u8)); } - if measurements.signal.is_some() { - return Ok(ExitCode::FAILURE); - } if let Some(code) = measurements.status { return Ok(ExitCode::from(code as u8)); } @@ -230,11 +221,14 @@ impl Time { dup2(null, io::stdout().as_raw_fd()).expect("could not replace stdout with null"); let err = exec::Command::new(&self.prog).args(&self.args).exec(); eprintln!("exec failed: {err}"); - Ok(ExitCode::FAILURE) + // mimic `timeout(1)` (although it distinguishes the command + // being found vs not found) + Ok(ExitCode::from(126)) } Err(err) => { eprintln!("fork failed: {err}"); - Ok(ExitCode::FAILURE) + // mimic `timeout(1)` + Ok(ExitCode::from(125)) } } }