aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMisty De Meo2012-05-10 14:15:23 -0500
committerMisty De Meo2012-05-11 09:48:51 -0500
commitb73b40fa1da84411cd7089116da1b20d55f0208d (patch)
treee2a09e19bd21fb880f6e2731290c8df06d0887c5 /Library
parentb4596d9ea4b4045373d959d1292b70ef4d79899d (diff)
downloadhomebrew-b73b40fa1da84411cd7089116da1b20d55f0208d.tar.bz2
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
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/doctor.rb7
1 files changed, 6 insertions, 1 deletions
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