From b73b40fa1da84411cd7089116da1b20d55f0208d 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 #12154 --- Library/Homebrew/cmd/doctor.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Library') 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