From 3294d1089e042c26aef2b2d33d67281410fc18a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luc=C3=ADa=20Andrea=20Illanes=20Albornoz?= Date: Sun, 19 Mar 2023 12:04:12 +0100 Subject: Kill child process tree w/ TERM then KILL on abort. --- build.sh | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/build.sh b/build.sh index 5be20410..30ca7d30 100755 --- a/build.sh +++ b/build.sh @@ -6,7 +6,7 @@ buildp_ast() { local _bpa_param="${1}" \ _bpa_cmd="" _bpa_pids="" _bpa_pids_new="" \ - _bpa_pids_niter=0 _bpa_pkg_name=""; + _bpa_pids_niter=0 _bpa_pkg_name="" _bpa_signal=""; for _bpa_cmd in \ rtl_fileop rtl_kill_tree rtl_lconcat \ @@ -23,15 +23,18 @@ buildp_ast() { rtl_log_msg "fatalexit" "${MSG_build_aborted}"; fi; - while [ "${_bpa_pids_niter}" -lt 8 ]; do - rtl_lconcat \$_bpa_pids "${_bpa_pids_new}"; - _bpa_pids_new=""; - if ! rtl_kill_tree \$_bpa_pids_new "${$}" "TERM"\ - || [ "${_bpa_pids_new:+1}" != 1 ]; then - break; - else - : $((_bpa_pids_niter+=1)); - fi; + for _bpa_signal in "TERM" "KILL"; do + _bpa_pids_niter=0; + while [ "${_bpa_pids_niter}" -lt 8 ]; do + rtl_lconcat \$_bpa_pids "${_bpa_pids_new}"; + _bpa_pids_new=""; + if ! rtl_kill_tree \$_bpa_pids_new "${$}" "${_bpa_signal}"\ + || [ "${_bpa_pids_new:+1}" != 1 ]; then + break; + else + : $((_bpa_pids_niter+=1)); + fi; + done; done; if [ "${_bpa_pids:+1}" = 1 ]; then -- cgit v1.2.3