From: nobu.nokada@... Date: 2002-04-24T11:42:23+09:00 Subject: Re: Data available on a pipe? Hi, At Wed, 24 Apr 2002 05:57:21 +0900, David Corbin wrote: > I have a pipe. I would like to read data ( preferably lines) from > this pipe, as long as there is data (a line) availble. I definatively > do not wish to block on this. What's "the ruby way" to do this? An easy way is to use threads. $ while sleep 3; do echo foo; done | > ruby -e 'Thread.new{while gets; print $_; end}' \ > -e '10.times {|i| puts i; sleep 1}' 0 1 2 foo 3 4 5 foo 6 7 8 foo 9 -- Nobu Nakada