summaryrefslogtreecommitdiff
path: root/usr.bin/timeout
diff options
context:
space:
mode:
authorJason McIntyre <jmc@cvs.openbsd.org>2021-09-02 21:50:25 +0000
committerJason McIntyre <jmc@cvs.openbsd.org>2021-09-02 21:50:25 +0000
commit4703c15ee89acdbc126902794f5e741650b47a6b (patch)
tree132bbcac02b4bc4563e07d5e7fb5cab59a54eed5 /usr.bin/timeout
parente7714cf57c83bb825081cf63a46d1fff9bbed7d7 (diff)
various improvements to the text/usage, chiefly removing alternative long
options from SYNOPSIS/usage; diff from leon fischer the opening sentence is mine - i say that not to take credit, just to distinguish that leon did not agree with wording
Diffstat (limited to 'usr.bin/timeout')
-rw-r--r--usr.bin/timeout/timeout.190
-rw-r--r--usr.bin/timeout/timeout.c8
2 files changed, 49 insertions, 49 deletions
diff --git a/usr.bin/timeout/timeout.1 b/usr.bin/timeout/timeout.1
index 4bd780ea33a..fb16d1ed103 100644
--- a/usr.bin/timeout/timeout.1
+++ b/usr.bin/timeout/timeout.1
@@ -1,3 +1,4 @@
+.\" $OpenBSD: timeout.1,v 1.2 2021/09/02 21:50:24 jmc Exp $
.\" $NetBSD: timeout.1,v 1.4 2016/10/13 06:22:26 dholland Exp $
.\"
.\" Copyright (c) 2014 Baptiste Daroussin <bapt@FreeBSD.org>
@@ -26,7 +27,7 @@
.\"
.\" $FreeBSD: head/usr.bin/timeout/timeout.1 268861 2014-07-18 22:56:59Z bapt $
.\"
-.Dd July 19, 2014
+.Dd $Mdocdate: September 2 2021 $
.Dt TIMEOUT 1
.Os
.Sh NAME
@@ -34,57 +35,53 @@
.Nd run a command with a time limit
.Sh SYNOPSIS
.Nm
-.Op Fl Fl signal Ar sig | Fl s Ar sig
-.Op Fl Fl preserve-status
-.Op Fl Fl kill-after Ar time | Fl k Ar time
-.Op Fl Fl foreground
-.Ao Ar duration Ac
-.Ao Ar command Ac
-.Ao Ar args ... Ac
+.Op Fl k Ar time
+.Op Fl s Ar sig
+.Op Fl -foreground
+.Op Fl -preserve-status
+.Ar duration
+.Ar command
+.Op Ar args
.Sh DESCRIPTION
+The
.Nm
-starts the
-.Ar command
-with its
-.Ar args .
+utility executes
+.Ar command ,
+with any
+.Ar args ,
+and kills it if it is still running after the
+specified
+.Ar duration .
If
-.Ar command
-is still running after
-.Ar duration ,
-it is killed.
-By default,
-.Dv SIGTERM
-is sent.
-.Bl -tag -width "-k time, --kill-after time"
-.It Fl Fl preserve-status
-Always exits with the same status as
-.Ar command
-even if it times out.
-.It Fl Fl foreground
-Do not propagate timeout to the
-.Ar command
-children.
-.It Fl s Ar sig , Fl Fl signal Ar sig
-Specify the signal to send on timeout.
-By default,
-.Dv SIGTERM
-is sent.
-.It Fl k Ar time , Fl Fl kill-after Ar time
-Send a second kill signal if
-.Ar command
-is still running after
+.Ar duration
+is 0, the timeout is disabled.
+.Pp
+The options are as follows:
+.Bl -tag -width Ds
+.It Fl k Ar time , Fl -kill-after Ns = Ns Ar time
+Send a second kill signal if the command is still running
.Ar time
after the first signal was sent.
+.It Fl s Ar sig , Fl -signal Ns = Ns Ar sig
+Specify the signal to send on timeout, instead of the default
+.Dv SIGTERM .
+.It Fl -foreground
+Do not propagate the timeout signal to children processes.
+.It Fl -preserve-status
+Always exit with the same status as
+.Ar command ,
+even if the timeout was reached.
.El
.Sh DURATION FORMAT
.Ar duration
and
.Ar time
-can be integer or decimal numbers.
-Values without unit symbols are interpreted as seconds.
+may contain a decimal fraction.
+The value defaults to seconds unless a unit suffix is given.
+.Pp
+The supported unit suffixes are:
.Pp
-Supported unit symbols are:
-.Bl -tag -width indent -compact
+.Bl -tag -width Ds -offset indent -compact
.It s
seconds
.It m
@@ -100,17 +97,18 @@ If the timeout was not reached, the exit status of
is returned.
.Pp
If the timeout was reached and
-.Fl Fl preserve-status
-is set, the exit status of
+.Fl -preserve-status
+was set, the exit status of
.Ar command
is returned.
If
-.Fl Fl preserve-status
-is not set, an exit status of 124 is returned.
+.Fl -preserve-status
+was not set, an exit status of 124 is returned.
.Pp
If
.Ar command
-exits after receiving a signal, the exit status returned is the signal number plus 128.
+exited after receiving a signal, the exit status returned is the signal number
+plus 128.
.Sh SEE ALSO
.Xr kill 1 ,
.Xr signal 3
diff --git a/usr.bin/timeout/timeout.c b/usr.bin/timeout/timeout.c
index cbceb70a3df..8a6e52702fc 100644
--- a/usr.bin/timeout/timeout.c
+++ b/usr.bin/timeout/timeout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: timeout.c,v 1.17 2021/09/02 11:26:54 semarie Exp $ */
+/* $OpenBSD: timeout.c,v 1.18 2021/09/02 21:50:24 jmc Exp $ */
/*
* Copyright (c) 2021 Job Snijders <job@openbsd.org>
@@ -53,8 +53,10 @@ static sig_atomic_t sig_ign = 0;
static void __dead
usage(void)
{
- fprintf(stderr, "usage: timeout [-s sig] [-k time] [--preserve-status]"
- " [--foreground] duration command\n");
+ fprintf(stderr,
+ "usage: timeout [-k time] [-s sig] [--foreground]"
+ " [--preserve-status] duration\n"
+ " command [args]\n");
exit(1);
}