NSFileHandle stdin sends ∞ notifications of 0 bytes available

2014-06-12 Thread Jerry Krinock
Hello, 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

Re: NSFileHandle stdin sends ∞ notifications of 0 bytes available

2014-06-12 Thread Greg Parker
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

Re: NSFileHandle stdin sends ∞ notifications of 0 bytes available

2014-06-12 Thread Jerry Krinock
On 2014 Jun 12, at 15:35, Greg Parker gpar...@apple.com wrote: If you get back an empty data object you are at end of file, and you should not call -waitForDataInBackgroundAndNotify again. Thank you, Greg. I thought that same thing a couple hours ago. But it trades one problem for

Re: NSFileHandle stdin sends ∞ notifications of 0 bytes available

2014-06-12 Thread Greg Parker
On Jun 12, 2014, at 4:53 PM, Jerry Krinock je...@ieee.org wrote: On 2014 Jun 12, at 15:35, Greg Parker gpar...@apple.com wrote: If you get back an empty data object you are at end of file, and you should not call -waitForDataInBackgroundAndNotify again. Thank you, Greg. I thought that same

Re: NSFileHandle stdin sends ∞ notifications of 0 bytes available

2014-06-12 Thread Jerry Krinock
On 2014 Jun 12, at 17:12, Greg Parker gpar...@apple.com wrote: This sends text via stdin, then closes stdin. Nothing the user types will appear on stdin. echo text | ./YourTool I see. Then the revised code is behaving correctly, so I should move on. Have a good evening, Greg!

Re: NSFileHandle stdin sends ∞ notifications of 0 bytes available

2014-06-12 Thread Greg Parker
On Jun 12, 2014, at 5:43 PM, Jerry Krinock je...@ieee.org wrote: On 2014 Jun 12, at 17:12, Greg Parker gpar...@apple.com wrote: This sends text via stdin, then closes stdin. Nothing the user types will appear on stdin. echo text | ./YourTool I see. Then the revised code is behaving