On Oct 6, 2007, at 7:00 PM, Daniel DeLorme wrote:

>
> Except that doesn't work. If the subprocess doesn't flush its  
> output, setting sync to true won't change anything. I tested with  
> this:
>
> IO.popen("ruby -e '10.times{puts rand;sleep 1}'") do |pipe|
>   pipe.sync = true
>   while str = pipe.gets
>     puts str
>   end
> end
>
> and I get the output in one big block after 10 seconds. Does open3/ 
> open4 change that? Somehow I doubt it.

not directly, although setting the STDOUT.sync=true *before* running  
popen will have that affect on some systems - where that's inherited  
parent -> child.

you are correct that you can't completly control the buffering  
behaviour of child processes, however.


cheers.

a @ http://codeforpeople.com/
--
share your knowledge.  it's a way to achieve immortality.
h.h. the 14th dalai lama