[PATCH 2/3] gitk: avoid fatal error if `exec osascript` fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



starting with macOS 10.14 calling "System Events" requires an
"Automation" grant, that will result in a fatal error showing:

  Error in startup script: 66:111: execution error: Not authorized to send Apple events to System Events. (-1743)

instead of aborting catch the error and print a suitable warning.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@xxxxxxxxx>
---
 gitk | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/gitk b/gitk
index f68d983..b62c12f 100755
--- a/gitk
+++ b/gitk
@@ -12291,11 +12291,15 @@ if {[catch {package require Tk 8.4} err]} {
 # on macOS bring the current Wish process window to front if needed
 if {[tk windowingsystem] eq "aqua"} {
     if {$tcl_version < 8.6} {
-        exec osascript -e [format {
-            tell application "System Events"
-                set frontmost of processes whose unix id is %d to true
-            end tell
-        } [pid] ]
+        if {[catch {
+            exec osascript -e [format {
+                tell application "System Events"
+                    set frontmost of processes whose unix id is %d to true
+                end tell
+            } [pid] ]
+        } ]} {
+            puts stderr [mc "Warning: 'System Events' access denied"]
+        }
     }
 }
 
-- 
2.33.0.rc0.433.g9a510e7e11




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux