From 677aa078d7a97c4b83bb95feeecd0d073b333552 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Petr=20=C5=A0pa=C4=8Dek?= Date: Tue, 13 Oct 2020 12:53:07 +0200 Subject: [PATCH] tests: improve process cleanup after config tests Previously exit trap executed command "kill -9" even if there were no leftover processes and this lead to clutter in logs because kill complained about missing arguments. As a bonus the cleanup routine now prints information about leftover processes. --- scripts/test-config.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/test-config.sh b/scripts/test-config.sh index 3ae6c3aae..695e5182a 100755 --- a/scripts/test-config.sh +++ b/scripts/test-config.sh @@ -13,8 +13,13 @@ TEST_DIR="$(dirname ${TEST_FILE})" TMP_RUNDIR="$(mktemp -d)" function finish { - kill -s 9 $(jobs -p) || : - rm -rf "${TMP_RUNDIR}" + if [[ "$(jobs -p)" != "" ]] + then + echo "SIGKILLing leftover processes:" + jobs -l + kill -s SIGKILL $(jobs -p) + fi + rm -rf "${TMP_RUNDIR}" } trap finish EXIT -- 2.47.2