build_all: report parallel results in completion order (wait -n -p)

Previously the reaping loop waited on jobs in array order, so a finished build's
OK/FAILED line was delayed until the loop reached its PID (e.g. appimage done
but unreported while flatpak still ran). Use 'wait -n -p' to print each result
as soon as that build finishes.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-05-30 11:12:37 +02:00
parent 523a69698b
commit c950b8f3ca

View File

@@ -257,15 +257,21 @@ else
# From here until all jobs are reaped, Ctrl+C stops every build tree. # From here until all jobs are reaped, Ctrl+C stops every build tree.
trap _interrupt INT TERM trap _interrupt INT TERM
# Reap in completion order (wait -n) so each result prints the moment that
# build finishes, not when its slot comes up in the array.
FAILED=() FAILED=()
for pid in "${!PID2NAME[@]}"; do remaining=${#PID2NAME[@]}
name="${PID2NAME[$pid]}" while [ "$remaining" -gt 0 ]; do
if wait "$pid"; then if wait -n -p donepid; then rc=0; else rc=$?; fi
name="${PID2NAME[$donepid]:-}"
[ -z "$name" ] && continue
if [ "$rc" -eq 0 ]; then
echo " -> $name: OK" echo " -> $name: OK"
else else
echo " -> $name: FAILED (rc=$?)" echo " -> $name: FAILED (rc=$rc)"
FAILED+=("$name") FAILED+=("$name")
fi fi
remaining=$((remaining - 1))
done done
trap - INT TERM trap - INT TERM