Use block-form of File.open and let Ruby do the cleanup
This commit is contained in:
parent
8b2a8d0595
commit
771a28427c
@ -572,7 +572,7 @@ class Formula
|
||||
end
|
||||
wr.close
|
||||
|
||||
f = File.open(logfn, 'w')
|
||||
File.open(logfn, 'w') do |f|
|
||||
f.write(rd.read) until rd.eof?
|
||||
|
||||
Process.wait
|
||||
@ -586,10 +586,11 @@ class Formula
|
||||
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
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user