Method: ChildProcess::Unix::Process#stop

Defined in:
lib/childprocess/process.rb

#stop(timeout = 3, signal = nil) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/childprocess/process.rb', line 14

def stop(timeout = 3, signal=nil)
  assert_started

  unless signal.nil?
    send_signal signal
    return_unless_timeout.call(timeout)
  end

  send_term
  return_unless_timeout.call(timeout)

  send_kill
  wait
rescue Errno::ECHILD, Errno::ESRCH
  # handle race condition where process dies between timeout
  # and send_kill
  true
end