diff options
| author | ilovezfs | 2017-01-12 07:22:34 -0800 |
|---|---|---|
| committer | ilovezfs | 2017-01-12 07:22:34 -0800 |
| commit | ac7a59373087e9d49097ab7f0ddb691e64159959 (patch) | |
| tree | d5e6de1964acc316d1e3ddea4325065f2f603a22 | |
| parent | ebf3d939d1d63ea2cf8b8185e1c36a6e4a066d48 (diff) | |
| download | brew-ac7a59373087e9d49097ab7f0ddb691e64159959.tar.bz2 | |
InreplaceError: fix undefined method crash
When the first parameter to inreplace was an array, and the replacement
failed, InreplaceError would end up crashing with an undefined method
exception because the order of operations resulted in super not being
passed the value of the entire inject block.
| -rw-r--r-- | Library/Homebrew/utils/inreplace.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Library/Homebrew/utils/inreplace.rb b/Library/Homebrew/utils/inreplace.rb index c7557ab41..b4c219f06 100644 --- a/Library/Homebrew/utils/inreplace.rb +++ b/Library/Homebrew/utils/inreplace.rb @@ -1,9 +1,10 @@ module Utils class InreplaceError < RuntimeError def initialize(errors) - super errors.inject("inreplace failed\n") do |s, (path, errs)| + formatted_errors = errors.inject("inreplace failed\n") do |s, (path, errs)| s << "#{path}:\n" << errs.map { |e| " #{e}\n" }.join end + super formatted_errors end end |
