> On Jun 20, 2020, at 4:31 PM, Gabriel Zachmann <z...@cs.uni-bremen.de> wrote:
> 
>> 
>> If app B can be treated as a sub-process of app A you can use Process.  I 
>> know that argument passing works with Process.
> 
> Sounds good.  How can A launch B as its sub-process?  (and pass command line 
> arguments?)
> 
> 

let process = Process()
process.standardOutput = FileHandle.nullDevice
process.standardError = FileHandle.nullDevice
process.launchPath = url.path   // path to app
process.arguments = [“arg1”, “arg2”, “arg3”]
process.launch()

and if you need to

process.waitUntilExit()

Obviously don’t wait on the main thread!

I do this in an app where the URL points to a helper located in the bundle.  
Not sure what extra hoops you’d need to jump through to launch an app outside 
of the sandbox.   Probably needs user approval which can be remembered using a 
security scoped bookmark.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to