def stop(reason)
      if @pid
        begin
          Process.kill('KILL', @pid)
          Process.waitpid(@pid)
        rescue Errno::ESRCH, Errno::ECHILD
        end
      end
      @log.info "Killing pid: #{@pid.to_s}. Reason: #{reason}"
      @pid = nil
    end
def stop(reason)
      if @pid
        begin
          Process.kill('KILL', @pid)
          Process.waitpid(@pid)
        rescue Errno::ESRCH, Errno::ECHILD
        end
      end
      @log.info "Killing pid: #{@pid.to_s}. Reason: #{reason}"
      @pid = nil
    end
Stop the child process by issuing a kill -9.

 We then call waitpid() with the pid, which waits for that particular
 child and reaps it.

 kill() can set errno to ESRCH if, for some reason, the file
 is gone; regardless the final outcome of this method
 will be to set our @pid variable to nil.

 Technically, kill() can also fail with EPERM or EINVAL (wherein
 the signal isn't sent); but we have permissions, and
 we're not doing anything invalid here.