summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-03-19 12:04:12 +0100
committerLucía Andrea Illanes Albornoz <lucia@luciaillanes.de>2023-03-19 12:04:12 +0100
commit3294d1089e042c26aef2b2d33d67281410fc18a5 (patch)
tree38d4e530b444cf1e572a9bb3d1d3ba794d00ffde
parent3b8b69a84099542cc7e58cc9ae3fafb8a11599ba (diff)
downloadmidipix_build-3294d1089e042c26aef2b2d33d67281410fc18a5.tar.bz2
midipix_build-3294d1089e042c26aef2b2d33d67281410fc18a5.tar.xz
Kill child process tree w/ TERM then KILL on abort.
-rwxr-xr-xbuild.sh23
1 files 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