diff options
| author | Misty De Meo | 2012-05-10 14:15:23 -0500 |
|---|---|---|
| committer | Misty De Meo | 2012-05-11 09:48:51 -0500 |
| commit | 71d34a86d6cfa6c9d5b20cd56b3cccd013339448 (patch) | |
| tree | bd0f26e8cc241857c2cb999b40a792263d62a53f /Library/Homebrew | |
| parent | f8a6075af33384665e3ffe7c5b928af11b4e6a04 (diff) | |
| download | brew-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.rb | 7 |
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 |
