coreutils
[Top][All Lists]
Advanced

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

Proposed option for "timeout" -- don't wait for sub-command to exit


From: Dale R. Worley
Subject: Proposed option for "timeout" -- don't wait for sub-command to exit
Date: Fri, 14 Apr 2023 14:49:38 -0400

Infrequently but repeatedly I've wanted a shell script to be able to
start a background command, wait up to a certain duration for the
command to finish, and then if it hasn't finished, the script continues,
leaving the background command to continue executing.  Other people
desire this, too, e.g.
https://unix.stackexchange.com/questions/84973/timeout-without-killing-process-in-bash
You can get this effect (without a wait loop) using "sleep NNN & wait -n
...", but you get extraneous job control output and it's awkward to
code.

Gnu "timeout" is the utility I would expect to implement this
functionality, but it does not -- timeout won't exit until the
sub-command exits no matter how you invoke it.

So I am proposing adding an option to "timeout" viz. "-n/--no-wait"
whose effect is "after the timeout is triggered and timeout sends the
specified signal(s), timeout continues without waiting for the command
to exit".  When this combined with "--signal=0", "timeout" will behave
as I desire.

Opinions?

Dale



reply via email to

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