# File lib/background_process/pty_background_process.rb, line 38
  def wait(timeout = nil)
    begin
      Timeout.timeout(timeout) do
        Process.wait(@pid)
      end
    rescue Timeout::Error
      nil
    rescue PTY::ChildExited
      true
    rescue Errno::ECHILD
      true
    end
  end