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.



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

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.



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

def exit_code
  @exit_code
end

Instance Method Details

#failure?Boolean

Returns:

  • (Boolean)


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

def failure? = !@success

#success?Boolean

Returns:

  • (Boolean)


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

def success? = @success