Methods

ChildProcess::Unix::Process

Attributes

pid[R]

@return [Fixnum] the pid of the process after it has started

Public Instance Methods

exited?() click to toggle source

Did the process exit?

@return [Boolean]

# File lib/childprocess/unix/process.rb, line 37
def exited?
  return true if @exit_code

  assert_started
  pid, status = ::Process.waitpid2(@pid, ::Process::WNOHANG)

  log(:pid => pid, :status => status)

  if pid
    @exit_code = status.exitstatus || status.termsig
  end

  !!pid
end
io() click to toggle source
# File lib/childprocess/unix/process.rb, line 9
def io
  @io ||= Unix::IO.new
end
stop(timeout = 3) click to toggle source
# File lib/childprocess/unix/process.rb, line 13
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

[Validate]

Generated with the Darkfish Rdoc Generator 2.