aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorJack Nagel2013-09-07 10:22:58 -0500
committerJack Nagel2013-09-07 10:22:58 -0500
commit9bb326dab375f13e9af6ec45c7703e6fe0407003 (patch)
treec9df02b4c9fc4b401f7b5f7983fcd6bb914e8de1 /Library
parent340562a843ca69b853cb99e074ba165a08476d86 (diff)
downloadhomebrew-9bb326dab375f13e9af6ec45c7703e6fe0407003.tar.bz2
Use block-form of File.open and let Ruby do the cleanup
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/formula.rb27
1 files changed, 14 insertions, 13 deletions
diff --git a/Library/Homebrew/formula.rb b/Library/Homebrew/formula.rb
index f01ca768a..15561b100 100644
--- a/Library/Homebrew/formula.rb
+++ b/Library/Homebrew/formula.rb
@@ -572,24 +572,25 @@ class Formula
end
wr.close
- f = File.open(logfn, 'w')
- f.write(rd.read) until rd.eof?
-
- Process.wait
-
- unless $?.success?
- f.flush
- Kernel.system "/usr/bin/tail", "-n", "5", logfn
- f.puts
- require 'cmd/--config'
- Homebrew.write_build_config(f)
- raise ErrorDuringExecution
+ File.open(logfn, 'w') do |f|
+ f.write(rd.read) until rd.eof?
+
+ Process.wait
+
+ unless $?.success?
+ f.flush
+ Kernel.system "/usr/bin/tail", "-n", "5", logfn
+ f.puts
+ require 'cmd/--config'
+ Homebrew.write_build_config(f)
+ raise ErrorDuringExecution
+ end
end
end
rescue ErrorDuringExecution
raise BuildError.new(self, cmd, args, $?)
ensure
- [rd, f].each { |io| io.close if io and not io.closed? }
+ rd.close if rd and not rd.closed?
ENV.update(removed_ENV_variables) if removed_ENV_variables
end