diff --git a/src/auditor/test-auditor.sh b/src/auditor/test-auditor.sh index edf5fec59..e7cdaa161 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 - kill `jobs -p` >/dev/null 2>/dev/null || true - wait exit 1 } +# Cleanup to run whenever we exit +function cleanup() +{ + kill `jobs -p` >/dev/null 2>/dev/null || true + wait +} + +# 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 1b5070a3b..ac1f4dcc8 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 - kill `jobs -p` >/dev/null 2>/dev/null || true - wait exit 1 } +# Cleanup to run whenever we exit +function cleanup() +{ + kill `jobs -p` >/dev/null 2>/dev/null || true + wait +} + +# Install cleanup handler (except for kill -9) +trap cleanup EXIT + # Operations to run before the actual audit function pre_audit () {