I take it back, I didn't.
This is what I have now:

require 'open3'
def doit(command)
   logfile = command.shift
   Open3.popen3(command.join(' ')) { |inp,out,err|
      fh = File.open(logfile,"w")
      out.each { |line| puts line; fh.print line }
      err.each { |line| puts line; fh.print line }
   }
   $? >> 8
end

however, as you can see, all the stderr stuff will be always shown at
the end. Is there no way to mix stdout and stderr the way it would
naturally be displaye don the screen at runtime?

db

On Thu, Mar 27, 2003 at 07:12:24AM +0900, Daniel Bretoi wrote:
> Hi,
> 
> I managed to sort it out :)
> 
> db
> 
> On Thu, Mar 27, 2003 at 07:06:49AM +0900, Daniel Bretoi wrote:
> > Thanks for your help so far guys.
> > 
> > Is this possible to do yet be able to get the stderr as well?
> > 
> > I'm trying to use Open3, but am having trobules to get the output as
> > it's occurring. 
> > 
> > db
> > 
> > On Thu, Mar 27, 2003 at 02:48:58AM +0900, Robert Klemme wrote:
> > > maybe something like this:
> > > 
> > > def doit(command)
> > >   IO.popen("command","r") do |io|
> > >     io.each { |line| puts line }
> > >   end
> > > 
> > >   # return status
> > >   $?
> > > end
> > > 
> > >     robert
> > > 
> > > "Daniel Bretoi" <lists / debonair.net> schrieb im Newsbeitrag
> > > news:20030326165818.GC99575 / zone.syracuse.net...
> > > > > Personally I do:
> > > > >
> > > > >    make >make.out 2>&1
> > > >
> > > >
> > > > I need to see the output to the screen while doing it. :/
> > > >
> > > > > You could write a different version of 'tee' which spawns the process
> > > of
> > > > > interest (ls) itself, and passes back the right return code: you'd run
> > > it as
> > > > >
> > > > >    teepee out ls /sldjclsc
> > > > >
> > > >
> > > > I thought of that. What in ruby would enable me to print output while
> > > > it's happening? A systemcall will let me see it. I can' twait for the
> > > > process to finish before seing output as some of the executions can take
> > > > hours, and there is useful output in the meantime.
> > > >
> > > > db
> > > >
> > > 
> > 
> > -- 
> > Mar 26 	Benjamin Thompson born, 1753, Count Rumford; physicist
> > Mar 26 	David Packard died, 1996; age of 83
> > Mar 26 	Popeye statue unveiled, Crystal City TX Spinach Festival, 1937
> > Mar 26 	Independence Day in Bangladesh
> > Mar 26 	Prince Jonah Kuhio Kalanianaole Day in Hawaii
> > Mar 26 	Emerson, Lake, and Palmer record "Pictures at an Exhibition" live, 1971
> 
> -- 
> Mar 26 	Benjamin Thompson born, 1753, Count Rumford; physicist
> Mar 26 	David Packard died, 1996; age of 83
> Mar 26 	Popeye statue unveiled, Crystal City TX Spinach Festival, 1937
> Mar 26 	Independence Day in Bangladesh
> Mar 26 	Prince Jonah Kuhio Kalanianaole Day in Hawaii
> Mar 26 	Emerson, Lake, and Palmer record "Pictures at an Exhibition" live, 1971

-- 
Mar 26 	Benjamin Thompson born, 1753, Count Rumford; physicist
Mar 26 	David Packard died, 1996; age of 83
Mar 26 	Popeye statue unveiled, Crystal City TX Spinach Festival, 1937
Mar 26 	Independence Day in Bangladesh
Mar 26 	Prince Jonah Kuhio Kalanianaole Day in Hawaii
Mar 26 	Emerson, Lake, and Palmer record "Pictures at an Exhibition" live, 1971