From 60ee10cfff65ec1d43f5ab0e461057423764d1b5 Mon Sep 17 00:00:00 2001 From: Uli Schlachter Date: Sat, 24 Sep 2016 15:56:36 +0200 Subject: [PATCH] tests/run.sh: Use the "timeout" command coreutils provides a timeout command. Use that instead of (badly) inventing our own version of it. This "timeout" command seems to be new. Let's hope everyone has it and think about alternative solutions only when needed. Fixes: https://github.com/awesomeWM/awesome/issues/1075 Signed-off-by: Uli Schlachter --- tests/run.sh | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/run.sh b/tests/run.sh index 009c859b3..7ee2aed80 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -182,7 +182,8 @@ fi start_awesome() { export DISPLAY="$D" cd $build_dir - DISPLAY="$D" "$AWESOME" -c "$RC_FILE" $AWESOME_OPTIONS > $awesome_log 2>&1 & + # Kill awesome after $timeout_stale seconds (e.g. for errors during test setup). + DISPLAY="$D" timeout $timeout_stale "$AWESOME" -c "$RC_FILE" $AWESOME_OPTIONS > $awesome_log 2>&1 & awesome_pid=$! cd - >/dev/null @@ -209,13 +210,6 @@ for f in $tests; do # Send the test file to awesome. cat $f | DISPLAY=$D "$AWESOME_CLIENT" 2>&1 - # Kill awesome after 1 minute (e.g. with errors during test setup). - (sleep $timeout_stale - if [ "$(ps -o comm= $awesome_pid)" = "${AWESOME##*/}" ]; then - echo "Killing (stale?!) awesome (PID $awesome_pid) after $timeout_stale seconds." - kill $awesome_pid - fi) & - # Tail the log and quit, when awesome quits. tail -n 100000 -f --pid $awesome_pid $awesome_log