From: Robert Klemme Date: 2007-03-27T16:55:11+09:00 Subject: Re: How do I implement the Unix 'tee' function for $stdout? On 27.03.2007 03:54, ara.t.howard@noaa.gov wrote: > On Tue, 27 Mar 2007, Nick Sieger wrote: > >> On 3/26/07, Larry Fast wrote: >>> I already discovered that I can redirect $stdout just by pointing it at >>> a new file handle. But what I really want is to have the output >>> continue to STDOUT but ALSO go into my logging file along with a pile of >>> trace data. This is very similar to the Unix program 'tee' >>> >>> Any suggestions? >> >> Funny, I was just writing this code last night for the latest release >> of ci_reporter. Have a look at the CI::Reporter::OutputCapture class >> at line 11, and its usage on line 50: >> >> http://tinyurl.com/29rhqj >> >> Cheers, >> /Nick >> > > > class TeeIO > attr 'tee' > > def initialize tee, io > @tee = tee > @io = io > end > > def << buf > @tee << buf > @io << " " > @io << buf > end > end I rarely drink tea. Can we please also have a CoffeaIO? Thank you! SCNR robert