From: Larry Fast Date: 2007-03-27T13:08:27+09:00 Subject: Re: How do I implement the Unix 'tee' function for $stdout? Nick Sieger wrote: > Have a look at the CI::Reporter::OutputCapture class > at line 11, and its usage on line 50: > http://tinyurl.com/29rhqj Thanks Nick, This is *almost* what I want. I want to MERGE $stdout, $stderr and my debugging output. If I change @captured_io to @@captured_io and move it outside Initialize, does everything else stay the same? The only changed section is then: class OutputCapture < DelegateClass(IO) def initialize(io, &assign) super @delegate_io = io @assign_block = assign @assign_block.call self end @@captured_io = StringIO.new Also, in your invocation on line 50, is {|io| $stdio = io} only used for resetting $stdout back to normal. Nothing else? -- Posted via http://www.ruby-forum.com/.