[Toybox] [PATCH] timeout: --foreground, --preserve-status, and --signal.
enh
enh at google.com
Sat Mar 9 18:04:39 PST 2019
--signal is simply a synonym for the exiting -s.
--foreground disables functionality we didn't yet have: putting the
child into a new process group. I've added the functionality and the
flag to disable it.
--preserve-status also makes it clear that our exit statuses didn't match
the coreutils version. In addition to callers that use --preserve-status
to get away from this madness, I also have callers that check for
specific exit values. This patch implements --preserve-status but also
fixes all the other exit statuses.
(The "125" exit value is broken for toybox in the same way that
`toybox grep --whoops ; echo $?` is. To fix this, we'd need some way to
signal that command-line parsing failures should exit with a different
value than the usual 1 --- 2 for grep, 125 for timeout. I've done as much
as grep manages, and left a TODO.)
Also add timeout tests. I couldn't think of an easy test for
--foreground, so I tested that manually with strace.
Also add some newlines to the `toybox --help` output to make it easier
to find the different sections, and expand the section on durations to
call out that fractions are supported as a matter of policy.
As long as timeout and sleep have text describing the duration syntax,
make them the same. (Personally I'd remove both in favor of the `toybox
--help` output, but as long as they're duplicated, keep them consistent.)
Also remove the SLEEP_FLOAT variant --- xparsetime means that sleep no
longer requires floating point to support sub-second resolution.
---
Config.in | 11 +++++++----
tests/timeout.test | 19 +++++++++++++++++++
toys/other/timeout.c | 38 ++++++++++++++++++++++++++++++--------
toys/posix/sleep.c | 14 ++++----------
4 files changed, 60 insertions(+), 22 deletions(-)
create mode 100644 tests/timeout.test
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-timeout-foreground-preserve-status-and-signal.patch
Type: text/x-patch
Size: 7540 bytes
Desc: not available
URL: <http://lists.landley.net/pipermail/toybox-landley.net/attachments/20190309/dbc1fc74/attachment-0002.bin>
More information about the Toybox
mailing list