GNU bug report logs -
#51135
timeout: --foreground causes exit status 124, even if KILL was used
Previous Next
Full log
Message #25 received at 51135 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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
[timeout--foreground-k-status.patch (text/x-patch, attachment)]
This bug report was last modified 3 years and 278 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.