GNU bug report logs - #6308
Preserve command exit code in timeout(3)

Previous Next

Package: coreutils;

Reported by: "Ángel González" <keisial <at> gmail.com>

Date: Sun, 30 May 2010 00:23:01 UTC

Severity: normal

Tags: moreinfo

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #31 received at 6308 <at> debbugs.gnu.org (full text, mbox):

From: Jim Meyering <jim <at> meyering.net>
To: Pádraig Brady <P <at> draigBrady.com>
Cc: 6308 <at> debbugs.gnu.org,
	Ángel González <keisial <at> gmail.com>,
	Thomas Krennwallner <tkren <at> kr.tuwien.ac.at>
Subject: Re: bug#6308: Preserve command exit code in timeout(3)
Date: Mon, 29 Oct 2012 09:44:30 +0100
Pádraig Brady wrote:
...
> Subject: [PATCH] timeout: add --exit-status to always propagate the command's
>  exit status
>
> It's useful for commands that support running for an indeterminite
> amount of time, to not return a specific timeout exit status (124),
> and instead let the command handle the timeout signal and return
> a status for the work done so far.
>
> * doc/coreutils.texi (timeout invocation): Describe the new option.
> * src/timeout.c (use_exit_status): A new global boolean to
> enable the --exit-status behavior.

Thanks.  This looks fine.

Did you consider calling it --preserve-exit-status?
That seems more descriptive to me, since it preserves the exit
status of the command that timeout runs.
When I first saw --exit-status, I wondered if it should have an =N
after it, by which to specify a specific number.

> (usage): Describe the new option.
> (main): Don't return EXIT_TIMEOUT of use_exit_status is set.
> * tests/misc/timeout.sh: Add a test for the new option.
> ---
>  doc/coreutils.texi    |    6 ++++++
>  src/timeout.c         |   28 +++++++++++++++++++---------
>  tests/misc/timeout.sh |    5 +++++
>  3 files changed, 30 insertions(+), 9 deletions(-)
>
> diff --git a/doc/coreutils.texi b/doc/coreutils.texi
...
> @@ -214,6 +217,9 @@ Start COMMAND, and kill it if still running after DURATION.\n\
>  Mandatory arguments to long options are mandatory for short options too.\n\
>  "), stdout);
>        fputs (_("\
> +      --exit-status\n\
> +                 exit with the same status as COMMAND even if the\n\
> +                 command timed out\n\

Slightly better:

                    exit with the same status as COMMAND, even when the\n\
                    command times out\n\




This bug report was last modified 12 years and 204 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.