Class: ProcessExecuter::Commands::Run Private
- Inherits:
-
SpawnWithTimeout
- Object
- SpawnWithTimeout
- ProcessExecuter::Commands::Run
- Defined in:
- lib/process_executer/commands/run.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.
Run a command and return the Result
Extends SpawnWithTimeout to provide the core functionality for ProcessExecuter.run.
It accepts all Process.spawn execution
options
plus the additional options timeout_after
, raise_errors
and logger
.
This class wraps any stdout or stderr redirection destinations in a MonitoredPipe.
This allows any class that implements #write
to be used as an output redirection
destination. This means that you can redirect to a StringIO which is not possible
with Process.spawn
.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from SpawnWithTimeout
#command, #elapsed_time, #options, #pid, #result, #status, #timed_out
Instance Method Summary collapse
-
#call ⇒ ProcessExecuter::Result
private
Run a command and return the result.
Methods inherited from SpawnWithTimeout
Constructor Details
This class inherits a constructor from ProcessExecuter::Commands::SpawnWithTimeout
Instance Method Details
#call ⇒ ProcessExecuter::Result
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
Wrap the stdout and stderr redirection destinations in pipes and then execute the command.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/process_executer/commands/run.rb', line 51 def call opened_pipes = wrap_stdout_stderr super.tap do log_result raise_errors if .raise_errors end ensure opened_pipes.each_value(&:close) opened_pipes.each { |option_key, pipe| raise_pipe_error(option_key, pipe) } end |