From: Phy Prabab Date: 2007-02-22T19:23:10+09:00 Subject: Re: ruby tail --0-1726549152-1172139787=:95291 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Benj,=0A=0Ahow would that work?=0A=0ATIA,=0APhy=0A=0A----- Original Message= ----=0AFrom: "benjohn@fysh.org" =0ATo: ruby-talk ML =0ASent: Thursday, February 22, 2007 2:05:06 AM=0ASubj= ect: Re: ruby tail=0A=0A> Kevin Jackson wrote:=0A>>> Actually, I am not sur= e how this would work. If I do this, I get no=0A>>> output from the file:= =0A>>>=0A>>> `tail -f sim.out`=0A>>>=0A>>> So there is something basic I am= missing here. Any help?=0A>>=0A>> it shells out to the process and waits = for it to return - with -f does=0A>> tail ever return? if not you may not b= e able to use it - AFAIK ` and=0A>> exec are the same - someone with better= ruby knowledge may be able to=0A>> offer a solution - perhaps using thread= s or something=0A> Use IO.popen:=0A>=0A> IO.popen('tail -f sim.out'){|f|=0A= > while line =3D f.gets=0A> p line=0A> end=0A> }=0A=0AOut o= f interest, the blocking call is "gets" here, right? Can you use=0AKernel.s= elect on a bunch of those handles?=0A=0ACheers,=0A Benj=0A=0A=0A>=0A> --= =0A> Alex=0A>=0A>=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A=0A =0A_____________________= _______________________________________________________________=0ADo you Ya= hoo!?=0AEveryone is raving about the all-new Yahoo! Mail beta.=0Ahttp://new= .mail.yahoo.com --0-1726549152-1172139787=:95291--