From ff4ac0ca4b41deba5e3cb100bee23431c694963f Mon Sep 17 00:00:00 2001
From: Laurent Bercot
Date: Sat, 15 Oct 2016 20:35:23 +0000
Subject: Implement a timeout in wait
---
doc/wait.html | 18 ++++++--
src/execline/wait.c | 125 ++++++++++++++++++++++++++++++++++++++++++----------
2 files changed, 115 insertions(+), 28 deletions(-)
diff --git a/doc/wait.html b/doc/wait.html
index 94587a1..913e17c 100644
--- a/doc/wait.html
+++ b/doc/wait.html
@@ -29,7 +29,7 @@
- wait [ -r ] { [ pids... ] } prog...
+ wait [ -I | -i ] [ -r | -t timeout ] { [ pids... ] } prog...
@@ -45,9 +45,19 @@ empty list, it waits for every child process it has.
Options
- - -r : reap mode. Do not pause until a child has
-exited; only reap all pending zombies. The read block must be empty
-for that option to be effective.
+ - -r : equivalent to -t 0. Do not
+pause: only reap processes that are already dead when wait
+is invoked.
+ - -t timeout : wait for a maximum
+of timeout milliseconds. If there still are living processes
+among pids... (or among wait's children if
+pids... is an empty list), after timeout
+milliseconds, they will not be reaped.
+ - -I : loose. If wait times out while
+waiting for children to die, it will still
+exec into prog.... This is the default.
+ - -i : strict. If wait times out, it
+will print an error message and exit 1.