From 71d34a86d6cfa6c9d5b20cd56b3cccd013339448 Mon Sep 17 00:00:00 2001 From: Misty De Meo Date: Thu, 10 May 2012 14:15:23 -0500 Subject: doctor: report if a path element is invalid Under certain circumstances, an invalid path element would cause File.expand_path to bail out. Catch mistakes and report them, then continue instead. Fixes Homebrew/homebrew#12154 --- Library/Homebrew/cmd/doctor.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/cmd/doctor.rb b/Library/Homebrew/cmd/doctor.rb index 1940ff272..33e01f0fc 100644 --- a/Library/Homebrew/cmd/doctor.rb +++ b/Library/Homebrew/cmd/doctor.rb @@ -32,7 +32,12 @@ end def path_folders - ENV['PATH'].split(':').collect{|p| remove_trailing_slash(File.expand_path(p))}.uniq + @path_folders ||= ENV['PATH'].split(':').collect do |p| + begin remove_trailing_slash(File.expand_path(p)) + rescue ArgumentError + onoe "The following PATH component is invalid: #{p}" + end + end.uniq.compact end -- cgit v1.2.3