Re: Re: Can't exec from a Cocoa app?
Re: Re: Can't exec from a Cocoa app?
- Subject: Re: Re: Can't exec from a Cocoa app?
- From: "Tom Harrington" <email@hidden>
- Date: Thu, 24 Aug 2006 10:48:09 -0600
On 8/24/06, Uli Kusterer <email@hidden> wrote:
Now, I'm wildly guessing here, but AFAIR exec and stuff like that
basically create a copy of the current application (or am I mixing
that up with fork?), where some things (like file descriptors to
stdin and stdout) may still be shared. So maybe that also applies to
a window server connection and that's why your app fails?
The short version is that fork creates a copy of the current process,
while exec replaces the current process with a new process binary.
It seems that while a straight exec doesn't work in this case, a fork
followed by an exec in the child process (and an exit in the parent)
is OK. I still need to check and see that everything's working as
expected but at least I'm not stumbling over an undocumented error
condition anymore.
[And for those wondering why I'm not using something more Cocoaesque,
like using NSTask or asking NSWorkspace to help me out, it's because
this code is in a signal handler function. Since signals are
delivered asynchronously it's generally not a good idea to use any
function calls not specifically documented as being safe for use in
that situation.]
--
Tom Harrington
email@hidden
AIM: atomicbird1
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden