Class: Microsandbox::ExitStatus

Inherits:
Object
  • Object
show all
Defined in:
lib/microsandbox/exec_handle.rb

Overview

The terminal status of a streamed execution (Microsandbox::ExecHandle#wait) or of a sandbox process (Sandbox#wait, Sandbox#stop_and_wait).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ ExitStatus

Returns a new instance of ExitStatus.



50
51
52
53
# File 'lib/microsandbox/exec_handle.rb', line 50

def initialize(data)
  @exit_code = data["exit_code"]
  @success = data["success"]
end

Instance Attribute Details

#exit_codeInteger? (readonly)

Returns the exit code, or nil when the process was terminated by a signal and so carries no code (e.g. a SIGKILL’d sandbox from Sandbox#kill then Sandbox#wait) — check #success? in that case.

Returns:

  • (Integer, nil)

    the exit code, or nil when the process was terminated by a signal and so carries no code (e.g. a SIGKILL’d sandbox from Sandbox#kill then Sandbox#wait) — check #success? in that case.



48
49
50
# File 'lib/microsandbox/exec_handle.rb', line 48

def exit_code
  @exit_code
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


56
# File 'lib/microsandbox/exec_handle.rb', line 56

def failure? = !@success

#success?Boolean

Returns:

  • (Boolean)


55
# File 'lib/microsandbox/exec_handle.rb', line 55

def success? = @success