Re: NSTask and piped commands
Re: NSTask and piped commands
- Subject: Re: NSTask and piped commands
- From: Jens Alfke <email@hidden>
- Date: Tue, 18 May 2010 13:13:34 -0700
On May 18, 2010, at 12:33 PM, appledev wrote:
> I dont want to use a call to a bash script, because of sneaking in bad commands.
As others said, it’s not a problem here because the command line is entirely hardcoded.
If you wanted to avoid using a shell, you’d have to start three separate NSTasks for the three commands (df, grep, awk) and hook the output pipe of one to the input of the next. I’m not sure how to do that.
Of course, you could skip the grep and awk tasks and do the job yourself — looks like you’re just matching against a string, breaking the lines into pieces and then formatting the result. Probably three or four lines of Obj-C.
—Jens_______________________________________________
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