James Coglan wrote:
> Hi all,
> 
> If I run an external process, e.g.
> 
> IO.popen('cucumber')
> 
> Then Ruby blocks while waiting for the whole output of the subprocess. 
> Is
> there a way to read the subprocess' output incrementally as it is being
> written?

What's almost certainly happening is that the process which is sending 
the output is buffering it, and not flushing the buffer.

If the subprocess is written in ruby, try adding "$stdout.sync = true" 
at the beginning.

Some apps will switch into unbuffered mode if they think they are 
talking to a human on a terminal (a tty or pty). There is an 
almost-undocumented 'pty' module in the standard library which you can 
use to run a program under a pty: see

http://www.ruby-forum.com/topic/133560

so give that a try if the process you're spawning is not one that you 
can modify.
-- 
Posted via http://www.ruby-forum.com/.