Re: Calling UNIX command from Cocoa
Re: Calling UNIX command from Cocoa
- Subject: Re: Calling UNIX command from Cocoa
- From: "Clark Cox" <email@hidden>
- Date: Fri, 17 Oct 2008 17:52:05 -0700
On Fri, Oct 17, 2008 at 4:14 PM, Aurora Phoenix
<email@hidden> wrote:
>
> Without knowing more specifics, I am struggling to find why one would need a
> full-blown class just to invoke a command.
Because it is easier to use, and it handles many edge cases. Also, you
are over-estimating the overhead of using a "full-blown class"; it is
lost in the noise when compared to the actual process
creation/launching.
> At the simplest, one could use
> the system(3) call
system() (or popen) will get a shell involved, thereby adding unneeded
complexity.
>, or the exec/spawn/fork/popen families depending on what
> you need.
Using NSTask *is* using the exec/spawn/fork families, just wrapped in
a cleaner interface.
> It is of course, possible to wrap up something fancy like using an
> NSDictionary to represent commandline arguments, etc. etc. but that is
> usually overkill, no?
It is only overkill because NSTask already exists. :)
--
Clark S. Cox III
email@hidden
_______________________________________________
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