Pull initialization code out of begin block

This commit is contained in:
Jack Nagel 2014-11-09 18:17:10 -06:00
parent b34fa6cfd8
commit 0578f1ff5a

View File

@ -106,6 +106,7 @@ class Pathname
def atomic_write content def atomic_write content
require "tempfile" require "tempfile"
tf = Tempfile.new(basename.to_s, dirname) tf = Tempfile.new(basename.to_s, dirname)
begin
tf.binmode tf.binmode
tf.write(content) tf.write(content)
@ -128,6 +129,7 @@ class Pathname
ensure ensure
tf.close! tf.close!
end end
end
def default_stat def default_stat
sentinel = parent.join(".brew.#{Process.pid}.#{rand(Time.now.to_i)}") sentinel = parent.join(".brew.#{Process.pid}.#{rand(Time.now.to_i)}")