diff options
| author | Alyssa Ross | 2016-09-22 13:27:33 +0100 |
|---|---|---|
| committer | Alyssa Ross | 2016-10-25 22:34:34 +0100 |
| commit | 6f0aabe70700654fdd19d1800fa61f4cdea25266 (patch) | |
| tree | 16b58f43e35c8902175221dc41d19f8622b39b91 /Library/Homebrew/cmd | |
| parent | 3f3fa4d0f7d5c28598fb7a2495d01efa35c7f7a2 (diff) | |
| download | brew-6f0aabe70700654fdd19d1800fa61f4cdea25266.tar.bz2 | |
uninstall: refuse when dependants still installed
Closes #934.
Diffstat (limited to 'Library/Homebrew/cmd')
| -rw-r--r-- | Library/Homebrew/cmd/uninstall.rb | 9 |
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 |
