From 37f820a168f38fab47cda39023533f9671ce33f8 Mon Sep 17 00:00:00 2001 From: Bryan Boreham Date: Tue, 7 Jun 2016 14:37:43 +0100 Subject: [PATCH] Fail the script if any of the background tasks fails --- test/setup.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/setup.sh b/test/setup.sh index 1e8ce207..f999aff9 100755 --- a/test/setup.sh +++ b/test/setup.sh @@ -27,6 +27,11 @@ setup_host() { for HOST in $HOSTS; do setup_host $HOST & + pids="$pids $!" done -wait +# Wait individually for tasks so we fail-exit on any non-zero return code +# ('wait' on its own always returns 0) +for pid in $pids; do + wait $pid; +done