Fail the script if any of the background tasks fails
This commit is contained in:
1 parent
73d7812dc5
commit
37f820a168
1 file changed
+6
-1
+6
-1
@@ -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
|
||||
Reference in new issue
Block a user