• 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
Re: Re: Can't exec from a Cocoa app?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Can't exec from a Cocoa app?
      • From: Douglas Davidson <email@hidden>
References: 
 >Can't exec from a Cocoa app? (From: "Tom Harrington" <email@hidden>)
 >Re: Can't exec from a Cocoa app? (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: Tiger apps on Panther
  • Next by Date: Re: Bindings Problem: KVO Not Being triggered?
  • Previous by thread: Re: Can't exec from a Cocoa app?
  • Next by thread: Re: Can't exec from a Cocoa app?
  • Index(es):
    • Date
    • Thread