From c43ef8b7049bce98f0c64699a6cb4e7eab80cd27 Mon Sep 17 00:00:00 2001 From: Jeffrey Finkelstein Date: Sat, 26 Mar 2022 10:18:30 -0400 Subject: [PATCH] timeout: support long form of --kill-after arg Add support for the long form of the `--kill-after` argument. Previously only the short form `-k` was supported. --- src/uu/timeout/src/timeout.rs | 2 ++ tests/by-util/test_timeout.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/uu/timeout/src/timeout.rs b/src/uu/timeout/src/timeout.rs index fbd955242..38187325c 100644 --- a/src/uu/timeout/src/timeout.rs +++ b/src/uu/timeout/src/timeout.rs @@ -134,7 +134,9 @@ pub fn uu_app<'a>() -> Command<'a> { ) .arg( Arg::new(options::KILL_AFTER) + .long(options::KILL_AFTER) .short('k') + .help("also send a KILL signal if COMMAND is still running this long after the initial signal was sent") .takes_value(true)) .arg( Arg::new(options::PRESERVE_STATUS) diff --git a/tests/by-util/test_timeout.rs b/tests/by-util/test_timeout.rs index 80e7240fe..82582d2e4 100644 --- a/tests/by-util/test_timeout.rs +++ b/tests/by-util/test_timeout.rs @@ -105,3 +105,13 @@ fn test_invalid_signal() { .fails() .usage_error("'invalid': invalid signal"); } + +/// Test that the long form of the `--kill-after` argument is recognized. +#[test] +fn test_kill_after_long() { + new_ucmd!() + .args(&["--kill-after=1", "1", "sleep", "0"]) + .succeeds() + .no_stdout() + .no_stderr(); +}