Method: Kennel::Console.tee_output
- Defined in:
- lib/kennel/console.rb
.tee_output ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/kennel/console.rb', line 52 def tee_output old_stdout = Kennel.out old_stderr = Kennel.err capture = StringIO.new Kennel.out = TeeIO.new([capture, Kennel.out]) Kennel.err = TeeIO.new([capture, Kennel.err]) yield capture.string ensure Kennel.out = old_stdout Kennel.err = old_stderr end |