Anonymous | Login | 2024-09-17 01:43 UTC |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ Issue History ] [ Print ] | ||||||
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 | 2024-06-11 09:07 | ||
Reporter | steffen | View Status | public | ||||
Assigned To | |||||||
Priority | normal | Resolution | Accepted As Marked | ||||
Status | Closed | ||||||
Name | steffen | ||||||
Organization | |||||||
User Reference | |||||||
Section | Vol. 3: Shell and Utilities | ||||||
Page Number | |||||||
Line Number | (Line or range of lines) | ||||||
Interp Status | --- | ||||||
Final Accepted Text | Note: 0006080 | ||||||
Summary | 0001586: timeout - new utility: run a command with a time limit | ||||||
Description |
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. |
||||||
Desired Action |
Add the timeout utility. Here is the current manual page as present on OpenBSD, taken from FreeBSD, under 2-clause BSD license: NAME timeout – run a command with a time limit SYNOPSIS timeout [-k time] [-s sig] [--foreground] [--preserve-status] duration command [args] DESCRIPTION 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: -k time Send a second signal, SIGKILL, if the command is still running time after the first signal was sent. SIGTERM. --foreground Do not propagate the timeout signal to children processes. --preserve-status Always exit with the same status as command, even if the timeout was reached. DURATION FORMAT duration and time may contain a decimal fraction. The value defaults to seconds unless a unit suffix is given. The supported unit suffixes are: s seconds m minutes h hours d days EXIT STATUS 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. |
||||||
Tags | issue8 | ||||||
Attached Files | |||||||
|
Relationships | ||||||
|
Notes | |
(0005920) geoffclare (manager) 2022-07-29 11:03 edited on: 2022-08-01 15:45 |
Suggested changes... On page 3301 insert a new page for timeout: NAME timeout - execute a utility with a time limit SYNOPSIS timeout [-fp] [-k time] [-s signal_name] duration utility [argument...] DESCRIPTION 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. OPTIONS The timeout utility shall conform to [xref to XBD 12.2]. OPERANDS 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 STDIN Not used. INPUT FILES None. ENVIRONMENT VARIABLES The following environment variables shall affect the execution of timeout: ASYNCHRONOUS EVENTS The default behavior specified in [xref to XCU 1.4] shall apply, except that: STDOUT Not used. STDERR The standard error shall be used only for diagnostic messages. OUTPUT FILES None. EXTENDED DESCRIPTION None. EXIT STATUS If the -p option is not specified and the time limit was reached: CONSEQUENCES OF ERRORS Default. APPLICATION USAGE Unlike the kill utility, the -s option of timeout is not required to accept the symbolic name 0 to represent signal value zero. EXAMPLES None. RATIONALE 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. FUTURE DIRECTIONS None. SEE ALSO kill CHANGE HISTORY 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 |
(0005971) geoffclare (manager) 2022-09-20 10:48 |
The timeout utility has been added in the Issue8NewAPIs branch in gitlab based on Note: 0005920 |
(0006080) geoffclare (manager) 2022-11-21 16:14 |
Make the changes from "Additional APIs for Issue 8, Part 2" (Austin/1273). |
Issue History | |||
Date Modified | Username | Field | Change |
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 |
2024-06-11 09:07 | agadmin | Status | Applied => Closed |
Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |