From: Jan Svitok Date: 2006-07-27T21:11:06+09:00 Subject: Re: Blocks question If you don't need to capture the svn output, try Kernel#system. Svn will write directly to STDOUT. If you do need to capture, then 1. I don't know ;-) 2. it'd depend on whether you're on windows or unix J. On 7/27/06, Jon Leighton wrote: > Matthew Smillie wrote: > > On Jul 27, 2006, at 9:46, Jon Leighton wrote: > > > >> end > >> steps. I > >> don't understand why this happens, can anyone explain my options > >> please? > > > > I can't reproduce this on my machine, but it sounds very much like > > it's being caused by buffered output. This might work: > > > > def step(msg) > > print msg + "..." > > STDOUT.flush > > yield > > puts "done" > > end > > Thanks, that works a treat. Now, another related question. Part of the > process involves checking the code out from Subversion. As Subversion > checks out, it writes lines to STDOUT saying what it is downloading. I > would like this to be outputted by by script in real time, rather than > when the whole command has finished running. Currently I am using a > method like this: > > def command(command) > open("|#{command}", "r") do |f| > f.each do |line| > puts line > STDOUT.flush > end > end > end > > However, that doesn't seem to work. The output still only comes when the > command has fully completed. Any ideas of what I can do? > > Thanks! > > -- > Posted via http://www.ruby-forum.com/. > >