mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
Check osascript output instead of exit status (#42951)
Capture osascript output into a variable and compare it to "true" when checking if an app is running. Updated quit_application and quit_and_track_application to use app_running=$(osascript ...) and [[ "$app_running" != "true" ]] rather than relying on the command's exit status. This makes the running check more reliable across osascript behaviors and avoids depending on its exit code.
This commit is contained in:
parent
06cb6f6044
commit
93d6e3cc43
1 changed files with 6 additions and 2 deletions
|
|
@ -535,7 +535,9 @@ const quitApplicationFunc = `quit_application() {
|
|||
local timeout_duration=10
|
||||
|
||||
# check if the application is running
|
||||
if ! osascript -e "application id \"$bundle_id\" is running" 2>/dev/null; then
|
||||
local app_running
|
||||
app_running=$(osascript -e "application id \"$bundle_id\" is running" 2>/dev/null)
|
||||
if [[ "$app_running" != "true" ]]; then
|
||||
return
|
||||
fi
|
||||
|
||||
|
|
@ -576,7 +578,9 @@ const quitAndTrackApplicationFunc = `quit_and_track_application() {
|
|||
local timeout_duration=10
|
||||
|
||||
# check if the application is running
|
||||
if ! osascript -e "application id \"$bundle_id\" is running" 2>/dev/null; then
|
||||
local app_running
|
||||
app_running=$(osascript -e "application id \"$bundle_id\" is running" 2>/dev/null)
|
||||
if [[ "$app_running" != "true" ]]; then
|
||||
eval "export $var_name=0"
|
||||
return
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue