Re: Mac OS Leopard: how to spawn an child "application"?
Re: Mac OS Leopard: how to spawn an child "application"?
- Subject: Re: Mac OS Leopard: how to spawn an child "application"?
- From: Ken Thomases <email@hidden>
- Date: Sat, 11 Jun 2011 11:06:14 -0500
On Jun 11, 2011, at 10:32 AM, Nick wrote:
> In Mac OS 10.6 (Snow Leopard) it is pretty simple to launch another
> application from within my application (in a way that my application becomes
> a "parent" process to the child) - i either may call [NSTask launchTask], or
> call fork()/exec() - either way, my process and the launched
> process-application are related by parent-child (and i can use pipes or
> socketpair for them to communicate).
>
> In Mac OS 10.5 (Leopard) launching a process is simple as well, unless this
> process is an Application (a bundle, that is supposed to have an icon in
> dock). If i start it with NSTask, i get "Application not responding" icon in
> dock (but the application works fine, only this behvior in Dock is very
> irritating). I suppose this is happening because usually start of an
> application is supposed to be performed by LaunchServices (my app has to
> delegate this job to LS, and therefore my process is not a parent of this
> newly spawned process).
>
> Is there any way to remain a parent of a just launched application?
Why do you care if it's the parent? What feature(s) of the parent-child relationship is (are) important? Maybe what you're trying to achieve can be accomplished in some other manner while still using NSWorkspace or Launch Services to launch the application (which is the right way).
If it's just inter-process communication, there are other options. For example, use Bonjour for the parent to advertise its service and for the child to find and connect to it. Or use Unix domain sockets with a path that is known to both. Using Launch Services, you can pass an Apple Event descriptor with additional parameter information, which the child can retrieve. (The methods of NSWorkspace claim to support this, but I've found them to be buggy in this regard.) Etc.
Regards,
Ken
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden