Hi

I am writing a tee function for ruby and am pretty close.
The problem I am having now is that I don't know
how to extend $stdout#write and have it survive
a system (or exec) call.

Below is some code illustrating what I have:

 > cat tee.rb
 module M
   def write(a)
     super("fred\n")
   end
 end
 
 $stdout.extend(M)
 puts "puts: should be fred" # prints twice for some reason
 system("echo", "system: should be fred") # no fred

 > ruby tee.rb
 fred
 fred
 system: should be fred

If this is not possible, maybe there is a way with alias_method,
but I haven't been able to get that going either.

TIA
-- 
Jim Freeze
Code Red. Code Ruby