Exception: CMD::Timeout

Inherits:
ProcessFailed show all
Defined in:
lib/scout/cmd.rb

Overview

ScoutCoder: exception raised by CMD.cmd when a command exceeds its :timeout option. It subclasses ProcessFailed, so generic rescue clauses for ProcessFailed also catch it. In pipe mode the stream is aborted with this exception (ConcurrentStream#abort), so consumers observe it through ConcurrentStream#stream_raise_exception when reading or joining the returned stream.

Instance Attribute Summary collapse

Attributes inherited from ProcessFailed

#msg, #pid

Instance Method Summary collapse

Constructor Details

#initialize(pid = Process.pid, command = nil, timeout = nil) ⇒ Timeout

Returns a new instance of Timeout.



24
25
26
27
28
# File 'lib/scout/cmd.rb', line 24

def initialize(pid = Process.pid, command = nil, timeout = nil)
  @command = command
  @timeout = timeout
  super(pid, "command '#{command}' exceeded timeout of #{timeout} seconds")
end

Instance Attribute Details

#commandObject (readonly)

Returns the value of attribute command.



23
24
25
# File 'lib/scout/cmd.rb', line 23

def command
  @command
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



23
24
25
# File 'lib/scout/cmd.rb', line 23

def timeout
  @timeout
end