From c915de82d86886629d1cc6808a8bb17b26606bfa Mon Sep 17 00:00:00 2001 From: Maarten van Gompel Date: Wed, 2 Dec 2020 00:34:47 +0100 Subject: [PATCH] Force new process group using setgid -f when starting anything that may possibly kill an entire progress group (kill -9 0) #117 This fixes https://todo.sr.ht/~mil/sxmo-tickets/117 and the crashes when toggling the modem monitor. Signed-off-by: Anjandev Momi --- scripts/core/sxmo_gesturehandler.sh | 4 ++-- scripts/modem/sxmo_modemmonitortoggle.sh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/core/sxmo_gesturehandler.sh b/scripts/core/sxmo_gesturehandler.sh index 673b13a..dd18454 100755 --- a/scripts/core/sxmo_gesturehandler.sh +++ b/scripts/core/sxmo_gesturehandler.sh @@ -76,10 +76,10 @@ if [ "$HANDLE" -ne 0 ]; then pkill -9 "$KEYBOARD" ;; "showmenu") - pidof dmenu || sxmo_appmenu.sh & + pidof dmenu || setsid -f sxmo_appmenu.sh & ;; "showsysmenu") - pidof dmenu || sxmo_appmenu.sh sys & + pidof dmenu || setsid -f sxmo_appmenu.sh sys & ;; "hidemenu") pkill -9 dmenu diff --git a/scripts/modem/sxmo_modemmonitortoggle.sh b/scripts/modem/sxmo_modemmonitortoggle.sh index a06e0b0..732b704 100755 --- a/scripts/modem/sxmo_modemmonitortoggle.sh +++ b/scripts/modem/sxmo_modemmonitortoggle.sh @@ -2,7 +2,7 @@ if pgrep -f sxmo_modemmonitor.sh; then pgrep -f sxmo_modemmonitor.sh | grep -Ev "^${$}$" | xargs -IP kill -TERM P else - sxmo_modemmonitor.sh & + setsid -f sxmo_modemmonitor.sh & fi NOTIFDIR="$XDG_CONFIG_HOME"/sxmo/notifications