From: Paul Winward Date: 2008-05-11T02:47:19+09:00 Subject: Re: capture output in real time Another approach I had tried was to use IO.select, as shown in http://whynotwiki.com/Ruby_/_Process_management ( attributed to Jamis Buck). This too, produced the same delay in output, but is shown below: Thank you for any help def read_until(pipe, stop_at, verbose = true) lines = [] line = "" while result = IO.select([pipe]) #, nil, nil, 10) next if result.empty? c = pipe.read(1) break if c.nil? line << c break if line =~ stop_at # Start a new line? if line[-1] == ?\n puts line if verbose lines << line line = "" end end lines end Paul Winward wrote: > Thanks for the suggestion but I'm still having the problem. > > Paul > > ara.t.howard wrote: >> On May 9, 2008, at 6:08 PM, Paul Winward wrote: >>> >>> Note, I'm avoiding STDOUT.flush in sleep.rb since I won't be able to >>> change the actual scripts I'll be passing to popen3. >> >> popen3 is going to be using fork/exec under the hood and should >> inherit the sync setting of STDOUT, so try setting >> >> STDOUT.sync = true >> >> before the popen and see if that helps - untested, but i'm running out >> the door.... >> >> cheers. >> >> a @ http://codeforpeople.com/ -- Posted via http://www.ruby-forum.com/.