How do I properly read from a pipe?

Albert Schlef wrote in post #1051173:

Lars Mai wrote in post #1051172:

So how do I let the programs I'm piping to think that there's no more
input?

Not sure about the EOF, but I think you need to use IO#close_write
instead of IO#close.

Thanks, it now works!

(I need to refresh my memory with Richard Stevens' Unix book...)

:slight_smile: There's one more thing I would do: put the writing into a separate
thread. If buffers are not sufficiently large enough your version
deadlocks.

Kind regards

robert

···

--
Posted via http://www.ruby-forum.com/\.