From 617a975b32110c95f920ebc904eec1ad38f2825d Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Tue, 24 Oct 2023 17:27:20 -0400 Subject: [PATCH] macOS: switch method to bring child processes to front Fixes https://gitlab.com/kicad/code/kicad/-/issues/14060 --- kicad/tools/kicad_manager_control.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kicad/tools/kicad_manager_control.cpp b/kicad/tools/kicad_manager_control.cpp index 650dc521ae..fa35815c8c 100644 --- a/kicad/tools/kicad_manager_control.cpp +++ b/kicad/tools/kicad_manager_control.cpp @@ -870,9 +870,13 @@ int KICAD_MANAGER_CONTROL::Execute( const TOOL_EVENT& aEvent ) if( pid > 0 ) { #ifdef __WXMAC__ + wxString script = wxString::Format( wxS( "tell application \"System Events\"\n" + " set frontmost of the first process whose unix id is %l to true\n" + "end tell" ), pid ); + // This non-parameterized use of wxExecute is fine because execFile is not derived // from user input. - wxExecute( "osascript -e 'activate application \"" + execFile + "\"'" ); + wxExecute( wxString::Format( "osascript -e '%s'", script ) ); #endif } else