aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/utils
diff options
context:
space:
mode:
authorilovezfs2017-01-12 07:22:34 -0800
committerilovezfs2017-01-12 07:22:34 -0800
commitac7a59373087e9d49097ab7f0ddb691e64159959 (patch)
treed5e6de1964acc316d1e3ddea4325065f2f603a22 /Library/Homebrew/utils
parentebf3d939d1d63ea2cf8b8185e1c36a6e4a066d48 (diff)
downloadbrew-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.
Diffstat (limited to 'Library/Homebrew/utils')
-rw-r--r--Library/Homebrew/utils/inreplace.rb3
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