wait individually

This commit is contained in:
Elio Bischof
2024-10-16 18:37:56 +02:00
parent 17e516abcd
commit 3ff49c3aff

View File

@@ -29,21 +29,26 @@ jobs:
GENERATE_PID=$! GENERATE_PID=$!
echo "Generate stubs PID: $GENERATE_PID" echo "Generate stubs PID: $GENERATE_PID"
echo "Wait for all background processes to finish" # Wait for docker-compose
while true; do wait $DOCKER_COMPOSE_PID
wait -n $DOCKER_COMPOSE_PID $INSTALL_BROWSERS_PID $GENERATE_PID if [ $? -ne 0 ]; then
EXIT_STATUS=$? echo "Docker Compose failed"
if [ $EXIT_STATUS -ne 0 ]; then exit 1
echo "A background process failed with exit code $EXIT_STATUS." fi
exit $EXIT_STATUS
fi # Wait for Playwright browser installation
# Check if all processes have finished wait $INSTALL_BROWSERS_PID
if ! kill -0 $DOCKER_COMPOSE_PID 2>/dev/null && \ if [ $? -ne 0 ]; then
! kill -0 $INSTALL_BROWSERS_PID 2>/dev/null && \ echo "Playwright browser installation failed"
! kill -0 GENERATE_PID 2>/dev/null; then exit 1
break fi
fi
done # Wait for gRPC stubs generation
wait $GENERATE_PID
if [ $? -ne 0 ]; then
echo "gRPC stubs generation failed"
exit 1
fi
echo "Generate and create a production build in the foreground" echo "Generate and create a production build in the foreground"
pnpm build pnpm build