Subject: bug#70219: Bug/Issue with timeout and signals

From: Pádraig Brady <[email-masked]>
Date: Sat, 6 Apr 2024 19:30:08 +0100

tag 70219 notabug
close 70219
stop

On 06/04/2024 16:50, Branden R. Williams via GNU coreutils Bug Reports wrote:
>    -k, --kill-after=DURATION
>                   also send a KILL signal if COMMAND is still running
>                     this long after the initial signal was sent

If you read the above carefully, please note the words _also_ and _initial_.
I.e. -k will cause _another_ signal to be sent, iff the first doesn't terminate the command.

Hopefully this example with all pertinent options explains things.
I.e. the first signal sent after 1s is ignored,
and the second kill signal sent after another 2s forcefully kills the command.

   $ date +%s; timeout -k 2s -s0 1s sleep inf; date +%s
   1712427916
   Killed
   1712427919

cheers,
Pádraig