diff --git a/Library/Homebrew/hardware.rb b/Library/Homebrew/hardware.rb index f7a21ebd8e..7ffd8714bf 100644 --- a/Library/Homebrew/hardware.rb +++ b/Library/Homebrew/hardware.rb @@ -55,8 +55,6 @@ class Hardware elsif OS.linux? require "os/linux/hardware" CPU.extend LinuxCPUs - else - raise "The system `#{`uname`.chomp}' is not supported." end def self.cores_as_words diff --git a/Library/Homebrew/os.rb b/Library/Homebrew/os.rb index b0d685fa4d..63c86b7f45 100644 --- a/Library/Homebrew/os.rb +++ b/Library/Homebrew/os.rb @@ -1,6 +1,6 @@ module OS def self.mac? - /darwin/i === RUBY_PLATFORM + /darwin/i === RUBY_PLATFORM && !ENV["HOMEBREW_TEST_GENERIC_OS"] end def self.linux? @@ -19,9 +19,5 @@ module OS elsif OS.linux? ISSUES_URL = "https://github.com/Homebrew/linuxbrew/wiki/troubleshooting" PATH_OPEN = "xdg-open" - # compatibility - ::MACOS_FULL_VERSION = ::MACOS_VERSION = "0" - else - raise "Unknown operating system" end end diff --git a/Library/Homebrew/os/mac.rb b/Library/Homebrew/os/mac.rb index 73e499d407..98053f4ba5 100644 --- a/Library/Homebrew/os/mac.rb +++ b/Library/Homebrew/os/mac.rb @@ -12,6 +12,8 @@ module OS ::MacOS = self # compatibility + raise "Loaded OS::Mac on generic OS!" if ENV["HOMEBREW_TEST_GENERIC_OS"] + # This can be compared to numerics, strings, or symbols # using the standard Ruby Comparable methods. def version diff --git a/Library/Homebrew/utils.rb b/Library/Homebrew/utils.rb index 84bfb59b00..6502d5070f 100644 --- a/Library/Homebrew/utils.rb +++ b/Library/Homebrew/utils.rb @@ -448,7 +448,9 @@ def exec_editor(*args) end def exec_browser(*args) - browser = ENV["HOMEBREW_BROWSER"] || ENV["BROWSER"] || OS::PATH_OPEN + browser = ENV["HOMEBREW_BROWSER"] || ENV["BROWSER"] + browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN) + return unless browser safe_exec(browser, *args) end diff --git a/Library/brew.rb b/Library/brew.rb index b72e24d3db..ba5857a767 100644 --- a/Library/brew.rb +++ b/Library/brew.rb @@ -141,7 +141,7 @@ rescue RuntimeError, SystemCallError => e rescue Exception => e Utils::Analytics.report_exception(e) onoe e - if internal_cmd + if internal_cmd && defined?(ISSUES_URL) $stderr.puts "#{Tty.white}Please report this bug:" $stderr.puts " #{Tty.em}#{OS::ISSUES_URL}#{Tty.reset}" end