Don't allow brew link to be run as sudo
This commit is contained in:
parent
6898eadcc5
commit
f7d7fb1e81
@ -2,6 +2,12 @@ module Homebrew extend self
|
|||||||
def link
|
def link
|
||||||
raise KegUnspecifiedError if ARGV.named.empty?
|
raise KegUnspecifiedError if ARGV.named.empty?
|
||||||
|
|
||||||
|
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 link'"
|
||||||
|
end
|
||||||
|
|
||||||
ARGV.kegs.each do |keg|
|
ARGV.kegs.each do |keg|
|
||||||
print "Linking #{keg}... "
|
print "Linking #{keg}... "
|
||||||
puts if ARGV.verbose?
|
puts if ARGV.verbose?
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user