Fail the script if any of the background tasks fails

This commit is contained in:
Bryan Boreham committed 2016-06-07 14:37:43 +01:00
1 parent 73d7812dc5
commit 37f820a168
1 file changed
+6 -1
+6 -1
View File
@@ -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