You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: safari.rb
    path of file: ./repos/opal/lib/opal/cli_runners
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'shellwords'
require 'socket'
require 'timeout'
require 'tmpdir'
require 'rbconfig'
require 'opal/os'
re
    
      def run_safari_driver
        raise 'Safari driver can be started only on localhost' if safari_driver_host != DEFAULT_SAFARI_DRIVER_HOST

        started = false

        safari_driver_cmd = %{/usr/bin/safaridriver \
          -p #{safari_driver_port} \
          #{ENV['SAFARI_DRIVER_OPTS']}}

        safari_driver_pid = Process.spawn(safari_driver_cmd, in: OS.dev_null, out: OS.dev_null, err: OS.dev_null)

        Timeout.timeout(30) do
          loop do
            break if safari_driver_running?
            sleep 0.5
          end
        end

        started = true

        yield
      rescue Timeout::Error => e
        puts started ? 'Execution timed out' : 'Failed to start Safari driver'
        raise e
      ensure
        Process.kill('HUP', safari_driver_pid) if safari_driver_pid
      end