Class: ProcessExecuter::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/process_executer/runner.rb

Overview

The Runner class executes subprocess commands and captures their status and output.

It does the following:

  • Run commands (call) with options for capturing output, handling timeouts, and merging stdout/stderr.
  • Process command results, including logging and error handling.
  • Raise detailed exceptions for common command failures, such as timeouts or subprocess errors.

This class is used internally by run.

Instance Method Summary collapse

Instance Method Details

#call(command, options) ⇒ ProcessExecuter::Result

Run a command and return the status including stdout and stderr output

Examples:

runner = ProcessExecuter::Runner.new()
result = runner.call('echo hello')
result = ProcessExecuter.run('echo hello')
result.success? # => true
result.exitstatus # => 0
result.stdout # => "hello\n"
result.stderr # => ""

Parameters:

Returns:


34
35
36
# File 'lib/process_executer/runner.rb', line 34

def call(command, options)
  spawn(command, options).tap { |result| process_result(result) }
end