summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2021-08-21 08:36:40 +0200
committerChristian Grothoff <christian@grothoff.org>2021-08-21 08:36:40 +0200
commitff2a923942bad8d193d32a985e46a1ed13d392b4 (patch)
tree5c96ce0925fd8f661c12dff6ed0acb8acaaacb16
parent711c0dbd837a43c1e1b29df675bb063f35865b95 (diff)
downloadanastasis-ff2a923942bad8d193d32a985e46a1ed13d392b4.tar.gz
anastasis-ff2a923942bad8d193d32a985e46a1ed13d392b4.tar.bz2
anastasis-ff2a923942bad8d193d32a985e46a1ed13d392b4.zip
-fix trap logic
-rwxr-xr-xsrc/cli/test_iban.sh27
1 files changed, 25 insertions, 2 deletions
diff --git a/src/cli/test_iban.sh b/src/cli/test_iban.sh
index a7695e5..d5bceda 100755
--- 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