fix #6483: ensure cleanup of processes on exit

This commit is contained in:
Christian Grothoff 2020-08-19 18:03:45 +02:00
parent 1cd3f3281b
commit a84c61dd82
No known key found for this signature in database
GPG Key ID: 939E6BE1E29FC3CC
2 changed files with 20 additions and 4 deletions

View File

@ -36,11 +36,19 @@ function exit_skip() {
# Exit, with error message (hard failure) # Exit, with error message (hard failure)
function exit_fail() { function exit_fail() {
echo $1 echo $1
kill `jobs -p` >/dev/null 2>/dev/null || true
wait
exit 1 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 # Operations to run before the actual audit
function pre_audit () { function pre_audit () {

View File

@ -36,11 +36,19 @@ function exit_skip() {
# Exit, with error message (hard failure) # Exit, with error message (hard failure)
function exit_fail() { function exit_fail() {
echo $1 echo $1
kill `jobs -p` >/dev/null 2>/dev/null || true
wait
exit 1 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 # Operations to run before the actual audit
function pre_audit () { function pre_audit () {