long lRc;
#if defined(__DARWIN__)
- if( (lRc = wxMacExecute(argv, flags, process)) != -1)
+ // wxMacExecute only executes app bundles.
+ // It returns an error code if the target is not an app bundle, thus falling
+ // through to the regular wxExecute for non app bundles.
+ lRc = wxMacExecute(argv, flags, process);
+ if( lRc != ((flags & wxEXEC_SYNC) ? -1 : 0))
return lRc;
#endif