Merge pull request #201 from Installomator/BLOCKING_PROCESS-quit

quit & quit_kill
This commit is contained in:
Armin Briegel
2021-07-14 13:48:56 +02:00
committed by GitHub

View File

@@ -34,6 +34,9 @@ NOTIFY=success
BLOCKING_PROCESS_ACTION=prompt_user BLOCKING_PROCESS_ACTION=prompt_user
# options: # options:
# - ignore continue even when blocking processes are found # - ignore continue even when blocking processes are found
# - quit app will be told to quit nicely, if running
# - quit_kill told to quit twice, then it will be killed
# Could be great for service apps, if they do not respawn
# - silent_fail exit script without prompt or installation # - silent_fail exit script without prompt or installation
# - prompt_user show a user dialog for each blocking process found # - prompt_user show a user dialog for each blocking process found
# abort after three attempts to quit # abort after three attempts to quit
@@ -380,6 +383,18 @@ checkRunningProcesses() {
appClosed=1 appClosed=1
case $BLOCKING_PROCESS_ACTION in case $BLOCKING_PROCESS_ACTION in
quit|quit_kill)
printlog "telling app $x to quit"
runAsUser osascript -e "tell app \"$x\" to quit"
if [[ $i > 2 && $BLOCKING_PROCESS_ACTION = "quit_kill" ]]; then
printlog "Changing BLOCKING_PROCESS_ACTION to kill"
BLOCKING_PROCESS_ACTION=kill
else
# give the user a bit of time to quit apps
printlog "waiting 30 seconds for processes to quit"
sleep 30
fi
;;
kill) kill)
printlog "killing process $x" printlog "killing process $x"
pkill $x pkill $x