From: ara.t.howard@... Date: 2007-03-27T10:54:27+09:00 Subject: Re: How do I implement the Unix 'tee' function for $stdout? 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 -a -- be kind whenever possible... it is always possible. - the dalai lama