[Libguestfs] [PATCH 12/46] ./run: Omit timeout -k option on RHEL 6.

Richard W.M. Jones rjones at redhat.com
Sat Aug 24 12:36:48 UTC 2013


From: "Richard W.M. Jones" <rjones at redhat.com>

If timeout doesn't have the -k option, don't use it.

(cherry picked from commit 8d68f1c5ceb5ac613393654bde58127e50c0f7bf)
(cherry picked from commit 2809754504ab5e7b7e5c8dff7c1e37f1568c8475)
---
 run.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/run.in b/run.in
index ed74713..d82ba56 100755
--- a/run.in
+++ b/run.in
@@ -182,12 +182,17 @@ fi
 # Originally 1h, but that is not long enough to run the C API
 # tests on Koji.
 timeout_period=4h
+timeout_kill=30s
 
 # Do we have Padraig's timeout utility (from coreutils)?
 if timeout --help >/dev/null 2>&1; then
+    # Does this version of timeout have the -k option?  (Not on RHEL 6)
+    if timeout -k 10s 10s true >/dev/null 2>&1; then
+        timeout_k_opt="-k $timeout_kill"
+    fi
     # Timeout (SIGTERM) after $timeout_period.
-    # Then send a second SIGKILL 30 seconds later.
-    timeout="timeout -k 30s $timeout_period"
+    # Then send a second SIGKILL $timeout_kill seconds later.
+    timeout="timeout $timeout_k_opt $timeout_period"
 fi
 
 pid=$$
-- 
1.8.3.1




More information about the Libguestfs mailing list