On 12/10/2021 02:55, Christoph Anton Mitterer wrote: > Thinking again about this: > > Don't you think one looses quite something if, with --foreground, one > cannot differ (via the exit status) between a timeout that allowed the > program to clean up and one (when KILLing) that didn't? > > > Even if the KILL happens via killing timeout itself, couldn't it just > return 128+9 in the case --foreground was enabled and the original > signal had already been sent? > Or is that technically not possible then? That is a fair point. If one is using --kill-after you have to check for both 124 and 137 anyway to see if it timed out. It is useful to know whether the command was forcably killed. Using --foreground to avoid the 137 exit status upon --kill-after is not until now documented, so we should probably adjust the exit status to be always 137 if a SIGKILL is sent. With the attached we now behave like: $ timeout -v -s0 --foreground -k2 1 sleep 3; echo $? timeout: sending signal EXIT to command ‘sleep’ timeout: sending signal KILL to command ‘sleep’ 137 $ timeout -v -s0 -k2 1 sleep 3; echo $? timeout: sending signal EXIT to command ‘sleep’ timeout: sending signal KILL to command ‘sleep’ Killed 137 cheers, Pádraig