# File lib/headless.rb, line 77
  def initialize(options = {})
    CliUtil.ensure_application_exists!('Xvfb', 'Xvfb not found on your system')

    @display = options.fetch(:display, DEFAULT_DISPLAY_NUMBER).to_i
    @xvfb_launch_timeout = options.fetch(:xvfb_launch_timeout, DEFAULT_XVFB_LAUNCH_TIMEOUT).to_i
    @autopick_display = options.fetch(:autopick, !options.key?(:display))
    @reuse_display = options.fetch(:reuse, true)
    @dimensions = options.fetch(:dimensions, DEFAULT_DISPLAY_DIMENSIONS)
    @video_capture_options = options.fetch(:video, {})

    already_running = xvfb_running? rescue false
    @destroy_at_exit = options.fetch(:destroy_at_exit, !(@reuse_display && already_running))

    @pid = nil # the pid of the running Xvfb process

    # FIXME Xvfb launch should not happen inside the constructor
    attach_xvfb
  end