Method: ChildProcess::Unix::Process#stop

Defined in:
lib/childprocess/unix/process.rb

#stop(timeout = 3) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/childprocess/unix/process.rb', line 10

def stop(timeout = 3)
  assert_started
  send_term

  begin
    return poll_for_exit(timeout)
  rescue TimeoutError
    # try next
  end

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