fix: Race condition in validate-examples parallel execution

The wait -n + pid array removal was buggy - it removed the first
pid from the array when any job finished, not the one that actually
completed. This caused the final wait loop to miss some processes.

Fix: Use bare 'wait' at the end which waits for ALL background
processes, regardless of what's in the pid array.
This commit is contained in:
russell@unturf.com 2026-02-09 18:02:33 -05:00
parent ed6c9666b2
commit bf7f890f46

View file

@ -333,12 +333,12 @@ validate_examples_parallel() {
fi
done
# Wait for ALL remaining jobs to complete
for pid in "${pids[@]}"; do
wait "$pid" 2>/dev/null || true
done
# Wait for ALL background jobs to complete (not just tracked pids)
# Using bare 'wait' ensures we catch all subprocesses, even those
# whose pids were incorrectly removed from the array by wait -n
wait
# Wait a bit more to ensure all file writes are complete
# Extra safety margin for filesystem sync
sleep 0.5
# Aggregate results from result files (since subshell variables don't propagate)