Skip to content

Commit

Permalink
fix wait issue in start.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Jun 23, 2024
1 parent 94bdd7d commit 5af0912
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/nodes/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,13 @@ else
fi

# we will exit when any of the background processes exits.
# we don't use `wait -n` because of compatibility issues between bash and zsh
initial_jobs=$(jobs -p | wc -l)
while true; do
for job in $(jobs -p); do
wait $job || exit 1
done
sleep 1
current_jobs=$(jobs -p | wc -l)
if [ "$current_jobs" -lt "$initial_jobs" ]; then
echo "A background job has exited, exiting ..."
exit 1
fi
sleep 1
done

0 comments on commit 5af0912

Please sign in to comment.