Don't allow sudo brew upgrade if not sensible

This commit is contained in:
Max Howell 2012-03-07 12:50:15 +00:00
parent a13ff43886
commit 6988a75b84

View File

@ -9,6 +9,12 @@ end
module Homebrew extend self
def upgrade
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
# note we only abort if Homebrew is *not* installed as sudo and the user
# calls brew as root. The fix is to chown brew to root.
abort "Cowardly refusing to `sudo brew upgrade'"
end
Homebrew.perform_preinstall_checks
outdated = if ARGV.named.empty?