class Psychic::Shell::ExecutionResult

Attributes

exitstatus[R]
stderr[R]
stdout[R]

Public Class Methods

new(results) click to toggle source
# File lib/psychic/shell/execution_result.rb, line 17
def initialize(results)
  @exitstatus = results.fetch(:exitstatus)
  # Needs to be UTF-8 to serialize as YAML
  @stdout = results.fetch(:stdout).force_encoding('utf-8')
  @stderr = results.fetch(:stderr).force_encoding('utf-8')
end

Public Instance Methods

error!() click to toggle source
# File lib/psychic/shell/execution_result.rb, line 24
def error!
  if @exitstatus != 0
    error = ExecutionError.new
    error.execution_result = self
    fail error
  end
end
to_s() click to toggle source
# File lib/psychic/shell/execution_result.rb, line 32
def to_s
  ''"
  Execution Result:
    exitstatus: #{exitstatus}
    stdout:
  #{stdout}
    stderr:
  #{stderr}
  "''
end