Method: Beaker::Subcommands::SubcommandUtil.with_captured_output
- Defined in:
- lib/beaker/subcommands/subcommand_util.rb
.with_captured_output ⇒ Object
Execute a task but capture stdout and stderr to a buffer
59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/beaker/subcommands/subcommand_util.rb', line 59 def self.with_captured_output begin old_stdout = $stdout.clone old_stderr = $stderr.clone $stdout = StringIO.new $stderr = StringIO.new yield ensure $stdout = old_stdout $stderr = old_stderr end end |