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.
The wrapper pipes are kept in internal per-call state that is combined
with the user's options only when Process.spawn is called. Subclasses
contribute additional redirections by overriding #internal_redirections.
The options object the caller gave is never modified, so it can be reused
for another run and result.options returns the destinations as the user
configured them.
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.
61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/process_executer/commands/run.rb', line 61 def call @opened_pipes = {} @redirection_overrides = internal_redirections wrap_stdout_stderr super.tap do log_result raise_errors if .raise_errors end ensure close_pipes_and_check_errors($ERROR_INFO) end |