summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-08-19 18:03:45 +0200
committerChristian Grothoff <christian@grothoff.org>2020-08-19 18:03:45 +0200
commita84c61dd82b17bc42593e5fd358cd0917d195f4f (patch)
tree3769ad4a28c807ea8768ac1aee6a8ccdd97314b6
parent1cd3f3281b19e2b739eca02a4b21f756e962f78c (diff)
downloadexchange-a84c61dd82b17bc42593e5fd358cd0917d195f4f.tar.gz
exchange-a84c61dd82b17bc42593e5fd358cd0917d195f4f.tar.bz2
exchange-a84c61dd82b17bc42593e5fd358cd0917d195f4f.zip
fix #6483: ensure cleanup of processes on exit
-rwxr-xr-xsrc/auditor/test-auditor.sh10
-rwxr-xr-xsrc/auditor/test-revocation.sh10
2 files changed, 18 insertions, 2 deletions
diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh
index edf5fec5..e7cdaa16 100755
--- a/src/auditor/test-auditor.sh
+++ b/src/auditor/test-auditor.sh
@@ -36,11 +36,19 @@ function exit_skip() {
# Exit, with error message (hard failure)
function exit_fail() {
echo $1
+ exit 1
+}
+
+# Cleanup to run whenever we exit
+function cleanup()
+{
kill `jobs -p` >/dev/null 2>/dev/null || true
wait
- exit 1
}
+# Install cleanup handler (except for kill -9)
+trap cleanup EXIT
+
# Operations to run before the actual audit
function pre_audit () {
diff --git a/src/auditor/test-revocation.sh b/src/auditor/test-revocation.sh
index 1b5070a3..ac1f4dcc 100755
--- a/src/auditor/test-revocation.sh
+++ b/src/auditor/test-revocation.sh
@@ -36,11 +36,19 @@ function exit_skip() {
# Exit, with error message (hard failure)
function exit_fail() {
echo $1
+ exit 1
+}
+
+# Cleanup to run whenever we exit
+function cleanup()
+{
kill `jobs -p` >/dev/null 2>/dev/null || true
wait
- exit 1
}
+# Install cleanup handler (except for kill -9)
+trap cleanup EXIT
+
# Operations to run before the actual audit
function pre_audit () {