|Anonymous | Login||2022-11-30 13:54 UTC|
|Main | My View | View Issues | Change Log | Docs|
|Viewing Issue Simple Details|
|ID||Category||Severity||Type||Date Submitted||Last Update|
|0001586||[1003.1(2016/18)/Issue7+TC2] Shell and Utilities||Editorial||Enhancement Request||2022-05-14 22:07||2022-11-24 10:12|
|Priority||normal||Resolution||Accepted As Marked|
|Section||Vol. 3: Shell and Utilities|
|Line Number||(Line or range of lines)|
|Final Accepted Text||Note: 0006080|
|Summary||0001586: timeout - new utility: run a command with a time limit|
As of today it is very complicated to reliably run a program from within
a sh(1)ell with a timeout, a sh(1)ell can only hardly kill a child after
a timeout without introducing a race, as shown in issue #1585.
All modern operating systems (to my knowledge) therefore ship
a timeout(1) command for some time, which can be used to reliably run
a program with a timeout set.
Add the timeout utility.
Here is the current manual page as present on OpenBSD, taken from
FreeBSD, under 2-clause BSD license:
timeout – run a command with a time limit
timeout [-k time] [-s sig] [--foreground] [--preserve-status] duration
The timeout utility executes command, with any args, and kills it if it
is still running after the specified duration. If duration is 0, the
timeout is disabled.
The options are as follows:
Send a second signal, SIGKILL, if the command is still running
time after the first signal was sent.
Do not propagate the timeout signal to children processes.
Always exit with the same status as command, even if the timeout
duration and time may contain a decimal fraction. The value defaults to
seconds unless a unit suffix is given.
The supported unit suffixes are:
If the timeout was not reached or --preserve-status was set, the exit
status of command is returned.
If the timeout was reached and --preserve-status was not set, an exit
status of 124 is returned.
If command exited after receiving a signal, the exit status returned is
the signal number plus 128.
edited on: 2022-08-01 15:45
On page 3301 insert a new page for timeout:
timeout - execute a utility with a time limit
timeout [-fp] [-k time] [-s signal_name] duration utility [argument...]
The timeout utility shall execute the utility named by the utility operand, with arguments supplied as the argument operands (if any), in a child process. If the value of the duration operand is non-zero and the child process has not terminated after the specified time period, timeout shall send the signal specified by the -s option, or the SIGTERM signal if -s is not given.
The timeout utility shall conform to [xref to XBD 12.2].
durationThe maximum amount of time to allow the utility to run, specified as a decimal number with an optional decimal fraction and an optional suffix, which can be:utility
The following environment variables shall affect the execution of timeout:
The default behavior specified in [xref to XCU 1.4] shall apply, except that:
The standard error shall be used only for diagnostic messages.
If the -p option is not specified and the time limit was reached:
CONSEQUENCES OF ERRORS
Unlike the kill utility, the -s option of timeout is not required to accept the symbolic name 0 to represent signal value zero.
Some timeout implementations make themselves a process group leader (when -f is not used) in order to be able to send signals to descendents of the child process. However, using this method means that any descendents which change their process group do not receive the signal. To ensure all descendents receive the signal, some implementations instead make use of a feature whereby descendents that are orphaned have their parent process changed to the timeout utility--that is, timeout becomes their ``reaper''--together with the ability of a reaper to send a signal to all of its descendents.
First released in Issue 8.
On page 2598 line 84368 section command, and
page 2694 line 87948 section env, and
page 3028 line 100764 section nice, and
page 3041 line 101203 section nohup, and
page 3299 line 111054 section time, and
page 3450 line 116526 section xargs, change:
The command, env, nice, nohup, time, and xargs utilitiesto:
The command, env, nice, nohup, time, timeout, and xargs utilities
|The timeout utility has been added in the Issue8NewAPIs branch in gitlab based on Note: 0005920|
|Make the changes from "Additional APIs for Issue 8, Part 2" (Austin/1273).|
|2022-05-14 22:07||steffen||New Issue|
|2022-05-14 22:07||steffen||Name||=> steffen|
|2022-05-14 22:07||steffen||Section||=> Vol. 3: Shell and Utilities|
|2022-05-14 22:07||steffen||Line Number||=> (Line or range of lines)|
|2022-07-29 11:03||geoffclare||Note Added: 0005920|
|2022-07-29 11:07||geoffclare||Relationship added||related to 0001594|
|2022-07-29 11:09||geoffclare||Note Edited: 0005920|
|2022-08-01 15:45||geoffclare||Note Edited: 0005920|
|2022-09-20 10:48||geoffclare||Note Added: 0005971|
|2022-11-21 16:14||geoffclare||Note Added: 0006080|
|2022-11-21 16:16||geoffclare||Interp Status||=> ---|
|2022-11-21 16:16||geoffclare||Final Accepted Text||=> Note: 0006080|
|2022-11-21 16:16||geoffclare||Status||New => Resolved|
|2022-11-21 16:16||geoffclare||Resolution||Open => Accepted As Marked|
|2022-11-21 16:17||geoffclare||Tag Attached: issue8|
|2022-11-24 10:12||geoffclare||Status||Resolved => Applied|
|Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group|