On Jun 15, 2008, at 12:00 PM, Ema Fuma wrote:

> Yes, I tried systemu and work exactly as you explained.
> Yes, for me it would be better to have my script cross-platform
> (providing for each OS the compiled executables to launch).
> With IO.popen I was able to parse at run-time line by line the stdout
> like this:
>
>           IO.popen(command) do |pipe|
>        pipe.each("\n") do |line|
>        puts line
>      end
>
> And it's working (Windows and OSX), the only problem I had was that
> timeout(10) wasn't ignored.
> Now what I want to achieve by the run-time parsing are two things:
> - display a progess of what is happening
> - check that the process keeps writing on stdout, so I know it's still
> alive. If it doesn't for 10 sec. exit the entire program.
>
> Is that possible?

i'm 99% positive that trying to read from the pipe will conflict with  
the timeout method - because of the way ruby uses green threads it's  
easy to lock up threads where io is concerned.  sometimes select can  
be used but it's a case by case basis for mixing threads, io, and non- 
blocking behaviour on windows.  YMMV.

cheers.

a @ http://codeforpeople.com/
--
we can deny everything, except that we have the possibility of being  
better. simply reflect on that.
h.h. the 14th dalai lama