diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2024-05-22 15:27:43 -0400 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2024-05-22 15:27:43 -0400 |
commit | 98191107e1dd2d186604bdb58990e020fc04c24e (patch) | |
tree | 7c625033358a223333d74d7f63a8e5131120a570 /tests/run.sh | |
parent | a5149bd2d269a6ad538c9a8e9820a85b17449dda (diff) | |
download | bfs-98191107e1dd2d186604bdb58990e020fc04c24e.tar.xz |
tests: Restart wait when interrupted by a signal
Diffstat (limited to 'tests/run.sh')
-rw-r--r-- | tests/run.sh | 21 |
1 files changed, 15 insertions, 6 deletions
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 } |