From 98191107e1dd2d186604bdb58990e020fc04c24e Mon Sep 17 00:00:00 2001 From: Tavian Barnes Date: Wed, 22 May 2024 15:27:43 -0400 Subject: tests: Restart wait when interrupted by a signal --- tests/run.sh | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'tests') diff --git a/tests/run.sh b/tests/run.sh index ad9c0be..629f756 100644 --- a/tests/run.sh +++ b/tests/run.sh @@ -112,12 +112,21 @@ reap_test() { # Wait for a background test to finish wait_test() { local pid - wait -n -ppid - ret=$? - if [ -z "${pid:-}" ]; then - debug "${BASH_SOURCE[0]}" $((LINENO - 3)) "${RED}error $ret${RST}" >&$DUPERR - exit 1 - fi + + while true; do + wait -n -ppid + ret=$? + + if [ "${pid:-}" ]; then + break + elif ((ret > 128)); then + # Interrupted by signal + continue + else + debug "${BASH_SOURCE[0]}" $((LINENO - 3)) "${RED}error $ret${RST}" >&$DUPERR + exit 1 + fi + done reap_test $ret } -- cgit v1.2.3