Re: Using NSPipe to get system command output
Re: Using NSPipe to get system command output
- Subject: Re: Using NSPipe to get system command output
- From: Ken Thomases <email@hidden>
- Date: Mon, 13 Aug 2012 19:47:37 -0500
On Aug 13, 2012, at 6:52 PM, Andy Lee wrote:
> You're very welcome. Although I wonder if you could simply replace the do-while loop with a call to NSTask's waitUntilExit method.
You can't unless you issue a -read..InBackgroundAndNotify method on the output file handle. Otherwise, if you're not reading from the pipe, it can fill up and block the task. Then you're deadlocked.
Also, -waitUntilExit has the nasty problem of running the run loop in the default mode. On the main thread, that mode is likely to have various and sundry sources and timers scheduled on it. That means that they may fire during your call to -waitUntilExit, which can have unpleasant side effects that you weren't expecting, possibly including recursion.
Regards,
Ken
_______________________________________________
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