From: Joel VanderWerf Date: 2005-02-25T08:27:04+09:00 Subject: Re: How to extend $stdout#write for system calls? Joel VanderWerf wrote: > class IO > def tee > IO.popen("-") do |pipe| # Won't work on mswin. > if pipe # parent > while (str = pipe.gets) > puts str > $stdout.puts str > end > else # child > yield > end > end > end > end > > f=File.open("/tmp/tee-example-output", "w+") f.tee do puts "something" puts "something else" system("echo", "from system") end Head.whack! I forgot to show that this does work with system calls...