aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/cmd/doctor.rb
diff options
context:
space:
mode:
authorJack Nagel2013-05-23 11:16:24 -0500
committerJack Nagel2013-05-23 11:28:16 -0500
commite8cec18e305b1894bed4b061ecf4dfa2f9a711b7 (patch)
tree32d46d00352a1d4e2a762008fdd603f7a3d45924 /Library/Homebrew/cmd/doctor.rb
parent57a3ec427e4fa5dccb175ae8c9fb95a8c91e3fdc (diff)
downloadhomebrew-e8cec18e305b1894bed4b061ecf4dfa2f9a711b7.tar.bz2
doctor: fix check_for_broken_symlinks
Fixes #20000.
Diffstat (limited to 'Library/Homebrew/cmd/doctor.rb')
-rw-r--r--Library/Homebrew/cmd/doctor.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb
index c7d158a6d..45c71ebc6 100644
--- a/Library/Homebrew/cmd/doctor.rb
+++ b/Library/Homebrew/cmd/doctor.rb
@@ -202,10 +202,12 @@ end
def check_for_broken_symlinks
require 'keg'
broken_symlinks = []
- Keg::PRUNEABLE_DIRECTORIES.each do |d|
- next unless d.directory?
- d.find do |pn|
- broken_symlinks << pn if pn.symlink? and pn.readlink.expand_path.to_s =~ /^#{HOMEBREW_PREFIX}/o and not pn.exist?
+
+ Keg::PRUNEABLE_DIRECTORIES.select(&:directory?).each do |d|
+ d.find do |path|
+ if path.symlink? && !path.resolved_path_exists?
+ broken_symlinks << path
+ end
end
end
unless broken_symlinks.empty? then <<-EOS.undent