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
This commit is contained in:
Misty De Meo 2012-05-10 14:15:23 -05:00
parent f8a6075af3
commit 71d34a86d6

View File

@ -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