aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd
diff options
context:
space:
mode:
authorAlyssa Ross2016-09-22 13:27:33 +0100
committerAlyssa Ross2016-10-25 22:34:34 +0100
commit6f0aabe70700654fdd19d1800fa61f4cdea25266 (patch)
tree16b58f43e35c8902175221dc41d19f8622b39b91 /Library/Homebrew/cmd
parent3f3fa4d0f7d5c28598fb7a2495d01efa35c7f7a2 (diff)
downloadbrew-6f0aabe70700654fdd19d1800fa61f4cdea25266.tar.bz2
uninstall: refuse when dependants still installed
Closes #934.
Diffstat (limited to 'Library/Homebrew/cmd')
-rw-r--r--Library/Homebrew/cmd/uninstall.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/uninstall.rb b/Library/Homebrew/cmd/uninstall.rb
index 8bcfc31fb..3d40c2350 100644
--- a/Library/Homebrew/cmd/uninstall.rb
+++ b/Library/Homebrew/cmd/uninstall.rb
@@ -16,6 +16,15 @@ module Homebrew
if !ARGV.force?
ARGV.kegs.each do |keg|
+ dependants = keg.installed_dependants
+ if dependants.any?
+ dependants_output = dependants.map { |k| "#{k.name} #{k.version}" }.join(", ")
+ conjugation = dependants.count == 1 ? "is" : "are"
+ ofail "Refusing to uninstall #{keg} because it is required by #{dependants_output}, which #{conjugation} currently installed."
+ puts "Remove it anyway with `brew uninstall --force #{keg.name}`."
+ next
+ end
+
keg.lock do
puts "Uninstalling #{keg}... (#{keg.abv})"
keg.unlink