On Jun 12, 2014, at 3:24 PM, Jerry Krinock <je...@ieee.org> wrote: > I need to develop a tool which processes stdin as it arrives from its parent > process. The following code works as expected when it is in invoked with no > stdin, that is… > > Air2:Debug jk$ ./MyTool > > But if I pipe some initial stdin to it, like this > > Air2:Debug jk$ echo Hello | ./MyTool > > after the initial notification and processing of “Hello”, the > notification-handling block infinitely receives repeated, different > notifications, for which -availableData returns an empty data object. > > I can’t understand and cannot work around it. Why am I getting infinitely > repeated notifications when there is no data available?
You reached end of file. " availableData Returns the data currently available in the receiver. … If the receiver is a communications channel, this method reads up to a buffer of data and returns it; if no data is available, the method blocks. Returns an empty data object if the end of file is reached. " If you get back an empty data object you are at end of file, and you should not call -waitForDataInBackgroundAndNotify again. -- Greg Parker gpar...@apple.com Runtime Wrangler _______________________________________________ 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