From 74e498a13b6691c4a288e81e99704de5e6a2a655 Mon Sep 17 00:00:00 2001 From: Christopher Dryden Date: Sun, 11 Jan 2026 22:20:32 +0000 Subject: [PATCH] timeout: display signal 0 as '0' instead of 'EXIT' in verbose mode --- src/uu/timeout/src/timeout.rs | 6 +++++- tests/by-util/test_timeout.rs | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index de20bec83c3..84d94634827 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -210,7 +210,11 @@ fn catch_sigterm() { /// Report that a signal is being sent if the verbose flag is set. fn report_if_verbose(signal: usize, cmd: &str, verbose: bool) { if verbose { - let s = signal_name_by_value(signal).unwrap(); + let s = if signal == 0 { + "0".to_string() + } else { + signal_name_by_value(signal).unwrap().to_string() + }; show_error!( "{}", translate!("timeout-verbose-sending-signal", "signal" => s, "command" => cmd.quote()) diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 9c5c6c1a465..adce254d5ec 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -58,7 +58,7 @@ fn test_verbose() { new_ucmd!() .args(&[verbose_flag, "-s0", "-k.1", ".1", "sleep", "1"]) .fails() - .stderr_only("timeout: sending signal EXIT to command 'sleep'\ntimeout: sending signal KILL to command 'sleep'\n"); + .stderr_only("timeout: sending signal 0 to command 'sleep'\ntimeout: sending signal KILL to command 'sleep'\n"); } }