Class: Cliqr::Executor::BufferedCommandRunner Private
- Inherits:
-
Object
- Object
- Cliqr::Executor::BufferedCommandRunner
- Defined in:
- lib/cliqr/executor/command_runner_factory.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Used to buffer command output
Instance Method Summary collapse
-
#run ⇒ Hash
private
Run the command handler but redirect stdout to a buffer.
Instance Method Details
#run ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Run the command handler but redirect stdout to a buffer
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cliqr/executor/command_runner_factory.rb', line 49 def run old_stdout = $stdout old_stderr = $stderr $stdout = old_stdout.is_a?(StringIO) ? old_stdout : StringIO.new('', 'w') $stderr = old_stderr.is_a?(StringIO) ? old_stderr : StringIO.new('', 'w') yield { :stdout => $stdout.string, :stderr => $stderr.string, :status => 0 } ensure $stdout = old_stdout $stderr = old_stderr end |