bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#51135: timeout: --foreground causes exit status 124, even if KILL wa


From: Pádraig Brady
Subject: bug#51135: timeout: --foreground causes exit status 124, even if KILL was used
Date: Tue, 12 Oct 2021 14:50:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0

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

Attachment: timeout--foreground-k-status.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]