aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew
diff options
context:
space:
mode:
authorMisty De Meo2012-05-10 14:15:23 -0500
committerMisty De Meo2012-05-11 09:48:51 -0500
commit71d34a86d6cfa6c9d5b20cd56b3cccd013339448 (patch)
treebd0f26e8cc241857c2cb999b40a792263d62a53f /Library/Homebrew
parentf8a6075af33384665e3ffe7c5b928af11b4e6a04 (diff)
downloadbrew-71d34a86d6cfa6c9d5b20cd56b3cccd013339448.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 Homebrew/homebrew#12154
Diffstat (limited to 'Library/Homebrew')
-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