fix(bash): correctly propagate exit errors

This commit is contained in:
Ruben Fiszel
2024-11-08 16:33:01 +01:00
parent 1c7d295c52
commit 8bc9a021a8
+12 -2
View File
@@ -89,8 +89,18 @@ cat bp | tail -1 >> ./result2.out &
# Run main.sh in the same process group
{bash} ./main.sh "$@" 2>&1 | tee bp &
# Wait for all background processes to finish
wait
pid=$!
# Wait for main.sh to finish and capture its exit status
wait $pid
exit_status=$?
# Clean up the named pipe and background processes
rm -f bp
# Exit with the captured status
exit $exit_status
"#,
bash = BIN_BASH.as_str(),
);