Skip to content

Commit 9ea24d6

Browse files
authored
timeout: display signal 0 as '0' instead of 'EXIT' in verbose mode (uutils#10194)
This is done to match a change in GNU coreutils after v9.9
1 parent c498595 commit 9ea24d6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/uu/timeout/src/timeout.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,11 @@ fn catch_sigterm() {
210210
/// Report that a signal is being sent if the verbose flag is set.
211211
fn report_if_verbose(signal: usize, cmd: &str, verbose: bool) {
212212
if verbose {
213-
let s = signal_name_by_value(signal).unwrap();
213+
let s = if signal == 0 {
214+
"0".to_string()
215+
} else {
216+
signal_name_by_value(signal).unwrap().to_string()
217+
};
214218
show_error!(
215219
"{}",
216220
translate!("timeout-verbose-sending-signal", "signal" => s, "command" => cmd.quote())

tests/by-util/test_timeout.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ fn test_verbose() {
5858
new_ucmd!()
5959
.args(&[verbose_flag, "-s0", "-k.1", ".1", "sleep", "1"])
6060
.fails()
61-
.stderr_only("timeout: sending signal EXIT to command 'sleep'\ntimeout: sending signal KILL to command 'sleep'\n");
61+
.stderr_only("timeout: sending signal 0 to command 'sleep'\ntimeout: sending signal KILL to command 'sleep'\n");
6262
}
6363
}
6464

0 commit comments

Comments
 (0)