Class: LittleGhost::Sandbox::Execution

Inherits:
Data
  • Object
show all
Defined in:
lib/little_ghost/sandbox.rb,
lib/little_ghost/sandbox.rb

Overview

Carries captured process output, exit status, and an optional execution error from Sandbox#execute or Sandbox#execute_program.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(stdout:, stderr:, exit_code:, error: nil) ⇒ Execution

Returns a new instance of Execution.



35
36
37
# File 'lib/little_ghost/sandbox.rb', line 35

def initialize(stdout:, stderr:, exit_code:, error: nil)
  super
end

Instance Attribute Details

#errorObject (readonly)

Returns the value of attribute error

Returns:

  • (Object)

    the current value of error



34
35
36
# File 'lib/little_ghost/sandbox.rb', line 34

def error
  @error
end

#exit_codeObject (readonly)

Returns the value of attribute exit_code

Returns:

  • (Object)

    the current value of exit_code



34
35
36
# File 'lib/little_ghost/sandbox.rb', line 34

def exit_code
  @exit_code
end

#stderrObject (readonly)

Returns the value of attribute stderr

Returns:

  • (Object)

    the current value of stderr



34
35
36
# File 'lib/little_ghost/sandbox.rb', line 34

def stderr
  @stderr
end

#stdoutObject (readonly)

Returns the value of attribute stdout

Returns:

  • (Object)

    the current value of stdout



34
35
36
# File 'lib/little_ghost/sandbox.rb', line 34

def stdout
  @stdout
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/little_ghost/sandbox.rb', line 39

def success?
  error.nil? && exit_code&.zero?
end