def alive?
      return true if defined?(@pid) && @pid && Process.kill(0, @pid)
      false
    rescue Errno::ENOENT, Errno::ESRCH
      false
    rescue Errno::EPERM
      raise MentosError, "EPERM checking if child process is alive."
    end
def alive?
      return true if defined?(@pid) && @pid && Process.kill(0, @pid)
      false
    rescue Errno::ENOENT, Errno::ESRCH
      false
    rescue Errno::EPERM
      raise MentosError, "EPERM checking if child process is alive."
    end
Check for a @pid variable, and then hit `kill -0` with the pid to
 check if the pid is still in the process table. If this function
 gives us an ENOENT or ESRCH, we can also safely return false (no process
 to worry about). Defensively, if EPERM is raised, in a odd/rare
 dying process situation (e.g., mentos is checking on the pid of a dead
 process and the pid has already been re-used) we'll want to raise
 that as a more informative Mentos exception.

 Returns true if the child is alive.