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

Richard W.M. Jones rjones at redhat.com
Sat Aug 24 11:04:21 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)
---
 run.in | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/run.in b/run.in
index bd10d4e..5ab008b 100755
--- a/run.in
+++ b/run.in
@@ -204,12 +204,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