mirror of
https://github.com/mtan93/Installomator.git
synced 2026-03-08 05:31:53 +00:00
Merge pull request #201 from Installomator/BLOCKING_PROCESS-quit
quit & quit_kill
This commit is contained in:
@@ -34,6 +34,9 @@ NOTIFY=success
|
||||
BLOCKING_PROCESS_ACTION=prompt_user
|
||||
# options:
|
||||
# - 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
|
||||
# - prompt_user show a user dialog for each blocking process found
|
||||
# abort after three attempts to quit
|
||||
@@ -380,6 +383,18 @@ checkRunningProcesses() {
|
||||
appClosed=1
|
||||
|
||||
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)
|
||||
printlog "killing process $x"
|
||||
pkill $x
|
||||
|
||||
Reference in New Issue
Block a user