• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Launching a Cocoa application with arguments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: Launching a Cocoa application with arguments
      • From: Ondra Cada <email@hidden>
  • Prev by Date: NSTextFieldCell focus?
  • Next by Date: Re: NSSystemMenu ?
  • Previous by thread: NSTextFieldCell focus?
  • Next by thread: Re: Launching a Cocoa application with arguments
  • Index(es):
    • Date
    • Thread