kill only if there are jobs

This commit is contained in:
olli 2024-03-26 10:44:23 +01:00
parent f24d18ca23
commit c982ac9fd3

View File

@ -1,4 +1,5 @@
function g_kill_all_background_jobs {
kill -9 $(jobs -p) >/dev/null 2>&1
local g_pids
readarray g_pids < <(jobs -p)
[ -n "${g_pids[0]}" ] && kill -9 ${pids[*]} >/dev/null 2>&1
}