Blob Blame History Raw
From 2944df76a60d447cb81d47d3fb4d4952bc024c68 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 19 Dec 2013 08:21:53 +0000
Subject: [PATCH] run: Use timeout --foreground option.

If timeout doesn't have this option (RHEL 6) don't use timeout at all.

Attempt to fix RHBZ#1025269.

(cherry picked from commit 681488877456b83f039dc518861f29ab4e1857f0)
---
 run.in | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/run.in b/run.in
index 5ab008b..5a45888 100755
--- a/run.in
+++ b/run.in
@@ -208,13 +208,13 @@ 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"
+    # Must use the --foreground option (RHBZ#1025269).
+    if timeout --foreground 2 sleep 0 >/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="timeout -k $timeout_kill $timeout_period"
+        fi
     fi
-    # Timeout (SIGTERM) after $timeout_period.
-    # Then send a second SIGKILL $timeout_kill seconds later.
-    timeout="timeout $timeout_k_opt $timeout_period"
 fi
 
 pid=$$
-- 
1.8.3.1