Re: fork/exec vs NSTask
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