commit ff2a923942bad8d193d32a985e46a1ed13d392b4 parent 711c0dbd837a43c1e1b29df675bb063f35865b95 Author: Christian Grothoff <christian@grothoff.org> Date: Sat, 21 Aug 2021 08:36:40 +0200 -fix trap logic Diffstat:
| M | src/cli/test_iban.sh | | | 27 | +++++++++++++++++++++++++-- |
1 file changed, 25 insertions(+), 2 deletions(-)
diff --git a/src/cli/test_iban.sh b/src/cli/test_iban.sh @@ -2,6 +2,31 @@ set -eu +# Exit, with status code "skip" (no 'real' failure) +function exit_skip() { + echo " SKIP: $1" + exit 77 +} + +# Exit, with error message (hard failure) +function exit_fail() { + echo " FAIL: $1" + exit 1 +} + +# Cleanup to run whenever we exit +function cleanup() +{ + for n in `jobs -p` + do + kill $n 2> /dev/null || true + done + wait +} + +# Install cleanup handler (except for kill -9) +trap cleanup EXIT + # Script's guidelines: #* uses 'CURRENCY=TESTKUDOS' and uses $CURRENCY for all @@ -86,8 +111,6 @@ echo "Sandbox started." #libeufin-sandbox serve &> sandbox.log & #sandbox_pid=$! # -# FIXME: not always both services get killed. -trap "echo Terminating services.; kill $nexus_pid; kill $sandbox_pid" EXIT # #curl -s --retry 5 --retry-connrefused $NEXUS_URL > /dev/null #curl -s --retry 5 --retry-connrefused $SANDBOX_URL > /dev/null