From: Chris Moline Date: 2001-07-30T11:56:17+09:00 Subject: [ruby-talk:18777] Re: Autoflush backquotes?? On Mon, Jul 30, 2001 at 08:30:06AM +0900, Harry Ohlsen wrote: > > def make( action ) > > print `cd #{ @ports_dir }/#{ @category }/#{ @portname }; > > make #{ action } #{ autoclean? ? "clean" : "" }` > > end > > > > What happens is I install a port it sits for a very long time and then > > prints huge gobs of info all at once. Everything works right, I just want > > it flushed right away. > > Perhaps this isn't as neat as you'd like, but you can do something like ... > > system("...").each do |line| > # Do something with the each line > end > > I'm pretty sure your code would get executed in parallel, rather than > waiting for the shell to complete. > > You can also do > > `...`.each do |line| > end > > of course. The first one works, the second one won't. You're right it's a bit ugly but it works, thanks a bunch :) Sincerly, Chris Moline