Subject: Re: bug#6308: Preserve command exit code in timeout(3)

From: Pádraig Brady <[email-masked]>
Date: Mon, 22 Oct 2012 10:20:14 +0100

On 10/21/2012 09:36 PM, Thomas Krennwallner wrote:
> Dear Jim, dear Pádraig,
>
> preserving the command's exit code is useful for, e.g., running solver
> competitions, where competition participants have an upper bound on the
> runtime for finding solutions to very hard problems.
>
> Imagine you want to run a command which is outputting (periodically or
> on-request) solutions to optimization problems, where better and better
> solutions will be printed over time, until the final solution is
> obtained.
>
> Now if the process gets interrupted by timeout's signal, the command
> will return with an exit code different from the one that means "final
> solution found".  If there was already an "interesting" solution found,
> a particular exit code would be returned, and if no solution has been
> found until the signal was received would result in yet another exit
> code.
>
> This way, one would easily obtain the status of the solution without
> parsing the output.  For exit code 124 one would only know that there
> was a timeout, but not if the computation has already revealed
> "interesting" results.
>
> I'm thus very interested into seeing timeout --exit-status.

Ok cool.

It's tempting to support this without an option.
I.E. for all commands that exit without WIFSIGNALED being set,
i.e. for all commands that catch and exit on signal reception.
However that wouldn't work in general I think due to cascading
timeout commands or commands that catch signals for cleanup etc.,
though I suppose the latter case might be catered for by
specifying a specific signal with the -s option.

So I'll look at adding this new option right after the
imminent 8.20 release.

thanks,
Pádraig.