Launching a Cocoa application with arguments
Launching a Cocoa application with arguments
- Subject: Launching a Cocoa application with arguments
- From: email@hidden (Simon Fraser)
- Date: Fri, 04 Oct 2002 17:48:04 -0700
I have a need to launch a cocoa app, and somehow feed it some arguments
early in the startup process. The launching process is not (necessarily)
a Cocoa app, so NSTask and NSWorkspace are out.
The Unix code that I'm porting from has the launching process do a
fork(), followed by an execv(). The launched process then does a fork()
to detach from the parent process. However, Carbon/Cocoa seem very
unhappy with this last fork(); the app crashes soon afterwards down
in Core Foundation code.
I could use Launch Services, but that can't pass command-line
arguments straight through (for no good reason, since it's
layered on top of fork()/execv()). It does have an AEDesc* for
'passThruParams', but how do I get to that on the Cocoa side?
The alternatives would be to call system(), but that suspends the
calling process, which I don't want. OK, system("foo -args &")
might work, but seems ugly.
Any ideas?
Thanks
Simon
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.