diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index 6944794f19c..3927a022ab5 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -296,7 +296,7 @@ fn wait_or_kill_process( }); Ok(exit_code) } else { - Ok(ExitStatus::TimeoutFailed.into()) + Ok(ExitStatus::CommandTimedOut.into()) } } Ok(None) => { diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 4bbc532e9cc..25262abfc5d 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -104,6 +104,13 @@ fn test_preserve_status() { } } +#[test] +fn test_kill_after_preserves_timeout_exit_without_preserve_status() { + new_ucmd!() + .args(&["-k", "1", "1", "sleep", "10"]) + .fails_with_code(124) + .no_output(); +} #[test] fn test_preserve_status_even_when_send_signal() { // When sending CONT signal, process doesn't get killed or stopped.