• 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: fork/exec vs NSTask
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fork/exec vs NSTask


  • Subject: Re: fork/exec vs NSTask
  • From: Alastair Houghton <email@hidden>
  • Date: Sun, 24 Oct 2010 19:52:36 +0100

On 24 Oct 2010, at 18:48, Thomas Clement wrote:

> On 24 oct. 2010, at 19:03, eveningnick eveningnick wrote:
>
>> Hello!
>> I am wondering, if  NSTask can be replaced with low-level fork/exec
>> calls. Looking through forums, i often met statements that launching a
>> process with "fork/exec" is not an "OS X way", especially if i am
>> using Cocoa framework (and i am using Cocoa!).
>
> Yes you can use fork/exec, that's what NSTask does.

FWIW, the "modern" UNIX way is to use posix_spawn(), which has some advantages over fork()/exec().  There's nothing wrong with using fork()/exec() or posix_spawn() in a Cocoa app, though do note that what you can do between the fork() and exec() calls is extremely limited---higher level frameworks, Cocoa included, are generally totally off-limits at that point.

Kind regards,

Alastair.

--
http://alastairs-place.net




_______________________________________________

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

References: 
 >fork/exec vs NSTask (From: eveningnick eveningnick <email@hidden>)
 >Re: fork/exec vs NSTask (From: Thomas Clement <email@hidden>)

  • Prev by Date: Re: What alhorithm does the launcher follow while processing bundle?
  • Next by Date: Re: fork/exec vs NSTask
  • Previous by thread: Re: fork/exec vs NSTask
  • Next by thread: Re: fork/exec vs NSTask
  • Index(es):
    • Date
    • Thread