From 472322af24e87e60bcdb341383bf8915d222079d Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Tue, 17 Apr 2012 17:08:36 -0500 Subject: [PATCH] Don't attempt to walk nonexistent directories Fixes Homebrew/homebrew#11298. Signed-off-by: Jack Nagel --- Library/Homebrew/cmd/doctor.rb | 1 + Library/Homebrew/cmd/prune.rb | 1 + 2 files changed, 2 insertions(+) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index bef15affff..a529f74029 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -183,6 +183,7 @@ def check_for_broken_symlinks broken_symlinks = [] %w[lib include sbin bin etc share].each do |d| d = HOMEBREW_PREFIX/d + next unless d.directory? d.find do |pn| broken_symlinks << pn if pn.symlink? and pn.readlink.expand_path.to_s =~ /^#{HOMEBREW_PREFIX}/ and not pn.exist? end diff --git a/Library/Homebrew/cmd/prune.rb b/Library/Homebrew/cmd/prune.rb index 6c6f51549e..75e6026df8 100644 --- a/Library/Homebrew/cmd/prune.rb +++ b/Library/Homebrew/cmd/prune.rb @@ -10,6 +10,7 @@ module Homebrew extend self dirs = [] %w[bin sbin etc lib include share Library/LinkedKegs].map{ |d| HOMEBREW_PREFIX+d }.each do |path| + next unless path.directory? path.find do |path| path.extend ObserverPathnameExtension if path.symlink?