Benj,
how would that work?
TIA,
Phy
···
----- Original Message ----
From: "benjohn@fysh.org" <benjohn@fysh.org>
To: ruby-talk ML <ruby-talk@ruby-lang.org>
Sent: Thursday, February 22, 2007 2:05:06 AM
Subject: Re: ruby tail
Kevin Jackson wrote:
Actually, I am not sure how this would work. If I do this, I get no
output from the file:`tail -f sim.out`
So there is something basic I am missing here. Any help?
it shells out to the process and waits for it to return - with -f does
tail ever return? if not you may not be able to use it - AFAIK ` and
exec are the same - someone with better ruby knowledge may be able to
offer a solution - perhaps using threads or somethingUse IO.popen:
IO.popen('tail -f sim.out'){|f|
while line = f.gets
p line
end
}
Out of interest, the blocking call is "gets" here, right? Can you use
Kernel.select on a bunch of those handles?
Cheers,
Benj
--
Alex
____________________________________________________________________________________
Do you Yahoo!?
Everyone is raving about the all-new Yahoo! Mail beta.
http://new.mail.yahoo.com