summaryrefslogtreecommitdiff
path: root/doc/wait.html
blob: a0928595d3c22de3280e862a226e198faa6cf24d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <meta http-equiv="Content-Language" content="en" />
  <title>execline: the wait command</title>
  <meta name="Description" content="execline: the wait command" />
  <meta name="Keywords" content="execline command wait" />
  <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
 </head>
<body>

<p>
<a href="index.html">execline</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The <tt>wait</tt> program </h1>

<p>
<tt>wait</tt> waits for a set of children, then executes a program.
</p>

<h2> Interface </h2>

<p>
 In an <a href="execlineb.html">execlineb</a> script:
</p>

<pre>
     wait [ -I | -i ] [ -r | -t <em>timeout</em> ] { [ <em>pids...</em> ] } <em>prog...</em>
</pre>

<ul>
 <li> <tt>wait</tt> reads a list of <em>pids</em> in a
(possibly empty) <a href="el_semicolon.html">block</a>,
and unquotes it. </li>
 <li> <tt>wait</tt> waits for every child whose pid is
listed in <em>pids...</em>. If <em>pids...</em> is an
empty list, it waits for every child process it has. </li>
 <li><tt>wait</tt> then execs into <em>prog...</em>. </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-r</tt>&nbsp;: equivalent to <tt>-t&nbsp;0</tt>. Do not
pause: only reap processes that are already dead when <tt>wait</tt>
is invoked. </li>
 <li> <tt>-t</tt>&nbsp;<em>timeout</em>&nbsp;: wait for a maximum
of <em>timeout</em> milliseconds. If there still are living processes
among <em>pids...</em> (or among <tt>wait</tt>'s children if
<em>pids...</em> is an empty list), after <em>timeout</em>
milliseconds, they will not be reaped. </li>
 <li> <tt>-I</tt>&nbsp;: loose. If <tt>wait</tt> times out while
waiting for children to die, it will still
exec into <em>prog...</em>. This is the default. </li>
 <li> <tt>-i</tt>&nbsp;: strict. If <tt>wait</tt> times out, it
will print an error message and exit 1. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> For <a href="https://pubs.opengroup.org/onlinepubs/9699919799/utilities/wait.html">POSIX
compatibility</a>, <tt>wait</tt> also works when it cannot find a block.
In that case, all its command line is interpreted as <em>pids...</em>
arguments and it does not execute into a program. Instead, it exits
with a conforming exit code. </li>
</ul>

</body>
</html>