Class: ProcessExecuter::Status

Inherits:
SimpleDelegator
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/process_executer/status.rb

Overview

A simple delegator for Process::Status that adds a timeout? attribute

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, timeout) ⇒ Status

Create a new Status object from a Process::Status and timeout flag

Examples:

status = Process.wait2(pid).last
timeout = false
ProcessExecuter::Status.new(status, timeout)

Parameters:

  • status (Process::Status)

    the status to delegate to

  • timeout (Boolean)

    true if the process timed out



26
27
28
29
# File 'lib/process_executer/status.rb', line 26

def initialize(status, timeout)
  super(status)
  @timeout = timeout
end

Instance Attribute Details

#timeout?Boolean (readonly)

True if the process timed out and was sent the SIGKILL signal

Examples:

status = ProcessExecuter.spawn('sleep 10', timeout: 0.01)
status.timeout? # => true

Returns:

  • (Boolean)


43
# File 'lib/process_executer/status.rb', line 43

def timeout? = @timeout