From 9724ef1aa22fe4c735439f36b200adb1e34c497a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hannes=20K=C3=B6rber?= Date: Thu, 2 May 2024 18:05:56 +0200 Subject: [PATCH] Only call kill when there are background jobs --- test.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test.sh b/test.sh index 73e7e93..7da638e 100755 --- a/test.sh +++ b/test.sh @@ -18,7 +18,9 @@ cleanup() { rm -rf "${tmpdir}" pids=() jobs -p | while IFS="" read -r line; do pids+=("$line"); done - kill "${pids[@]}" + if (( "${#pids[@]}" > 0)) ; then + kill "${pids[@]}" + fi } download_iso() {