From c217b80be2827473070f4f9a2e2cdafe639753bb Mon Sep 17 00:00:00 2001 From: can1357 Date: Wed, 18 Mar 2026 23:23:59 +0100 Subject: [PATCH] timeout: return timed-out status after kill grace period --- src/uu/timeout/src/timeout.rs | 2 +- tests/by-util/test_timeout.rs | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) 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.