class Opal::CliRunners::Firefox

def firefox_executable

def firefox_executable
  ENV['MOZILLA_FIREFOX_BINARY'] ||
    if OS.windows?
      [
        'C:/Program Files/Mozilla Firefox/firefox.exe'
      ].each do |path|
        next unless File.exist? path
        return path
      end
    elsif OS.macos?
      '/Applications/Firefox.app/Contents/MacOS/Firefox'
    else
      %w[
        firefox
        firefox-esr
      ].each do |name|
        next unless system('sh', '-c', "command -v #{name.shellescape}", out: '/dev/null')
        return name
      end
      raise 'Cannot find firefox executable'
    end
end