From 1ea79cd0b33501ce6ed16961d7c82adb8ceb3cd3 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 21 Feb 2017 18:31:34 +0000 Subject: [PATCH] keg: handle missing alias opt link on uninstall. Fixes an issue introduced in #1192 where there would be a failure if the alias link didn't exist on removal (which would be the case for anything with an alias installed before #1192 was merged). --- Library/Homebrew/keg.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/keg.rb b/Library/Homebrew/keg.rb index b31997d5a9..94e3ff55bf 100644 --- a/Library/Homebrew/keg.rb +++ b/Library/Homebrew/keg.rb @@ -239,7 +239,10 @@ class Keg def remove_opt_record opt_record.unlink - aliases.each { |a| (opt_record.parent/a).unlink } + aliases.each do |a| + next if !opt_record.symlink? && !opt_record.exist? + (opt_record.parent/a).delete + end opt_record.parent.rmdir_if_possible end