Class: ProcessExecuter::Commands::RunWithCapture Private
- Inherits:
-
Run
- Object
- SpawnWithTimeout
- Run
- ProcessExecuter::Commands::RunWithCapture
- Defined in:
- lib/process_executer/commands/run_with_capture.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.
Runs a subprocess, blocks until it completes, and returns the result
Extends Run to provide the core functionality for ProcessExecuter.run_with_capture.
It accepts all Process.spawn execution
options
plus the additional options timeout_after
, raise_errors
, logger
, and
merge_output
.
Like Run, any stdout or stderr redirection destinations are wrapped in a MonitoredPipe.
Instance Attribute Summary collapse
-
#stderr_buffer ⇒ StringIO
readonly
private
The buffer used to capture stderr.
-
#stdout_buffer ⇒ StringIO
readonly
private
The buffer used to capture stdout.
Attributes inherited from SpawnWithTimeout
#command, #elapsed_time, #options, #pid, #result, #status, #timed_out
Instance Method Summary collapse
-
#call ⇒ ProcessExecuter::ResultWithCapture
private
Run a command and return the result which includes the captured output.
Methods inherited from SpawnWithTimeout
Constructor Details
This class inherits a constructor from ProcessExecuter::Commands::SpawnWithTimeout
Instance Attribute Details
#stderr_buffer ⇒ StringIO (readonly)
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.
The buffer used to capture stderr
78 79 80 |
# File 'lib/process_executer/commands/run_with_capture.rb', line 78 def stderr_buffer @stderr_buffer end |
#stdout_buffer ⇒ StringIO (readonly)
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.
The buffer used to capture stdout
69 70 71 |
# File 'lib/process_executer/commands/run_with_capture.rb', line 69 def stdout_buffer @stdout_buffer end |
Instance Method Details
#call ⇒ ProcessExecuter::ResultWithCapture
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 a command and return the result which includes the captured output
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/process_executer/commands/run_with_capture.rb', line 47 def call @stdout_buffer = StringIO.new stdout_buffer.set_encoding(.effective_stdout_encoding) @stderr_buffer = StringIO.new stderr_buffer.set_encoding(.effective_stderr_encoding) begin super ensure log_command_output end end |