On 31 Jul 2012, at 3:33 PM, Mr. Gecko wrote: > I am having weird results with NSTask. It sometimes retrieves the output, and > other times receives nothing.
I haven't looked at the code you posted, but is it possible that you're reading from the NSPipe in such a way that you're mixing up the "end-of-file" indication with the "no more data is available right now, but may arrive later" indication? That's a common reason for this kind of problem. > My thinking is there is some sort of buffer on the NSPipe and by the time the > task quits, the buffer ether didn't receive the data or it hasn't prepared it > for sending the notification. IIRC, NSPipe simply wraps a Unix pipe, which will hold unread data even after the writer closes its end of the pipe (that is, the writer can write some data and exit before the reader reads anything, and the reader will still get all the data followed by EOF). _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com