| author | Alberto Bertogli
<albertito@blitiri.com.ar> 2026-10-03 16:35:56 UTC |
| committer | Alberto Bertogli
<albertito@blitiri.com.ar> 2026-10-03 16:35:56 UTC |
| parent | d74e6e3d2b63eb2bef7cb941b4f696f72c6add33 |
| test/util/lib.sh | +5 | -1 |
diff --git a/test/util/lib.sh b/test/util/lib.sh index dcb4265..f0edcfa 100644 --- a/test/util/lib.sh +++ b/test/util/lib.sh @@ -26,7 +26,11 @@ function init() { # Set traps to kill our subprocesses when we exit (for any reason). trap ":" TERM # Avoid the EXIT handler from killing bash. trap "exit 2" INT # Ctrl-C, make sure we fail in that case. - trap "kill 0" EXIT # Kill children on exit. + # Kill children on exit, and wait for them to finish, so they don't + # interfere with the next test (e.g. by still listening on a port). + # "wait" returns early (and with an error) if we get a signal while + # waiting, so we loop until it completes. + trap "kill 0; until wait; do :; done" EXIT } function chasquid() {