Hoist assignment to simplify a conditional

This commit is contained in:
Jack Nagel 2014-02-22 21:39:38 -05:00
parent a836602024
commit 85feea33c0

View File

@ -548,6 +548,7 @@ class Formula
# Throws if there's an error # Throws if there's an error
def system cmd, *args def system cmd, *args
removed_ENV_variables = {} removed_ENV_variables = {}
rd, wr = IO.pipe
# remove "boring" arguments so that the important ones are more likely to # remove "boring" arguments so that the important ones are more likely to
# be shown considering that we trim long ohai lines to the terminal width # be shown considering that we trim long ohai lines to the terminal width
@ -568,7 +569,6 @@ class Formula
logfn = "#{logd}/%02d.%s" % [@exec_count, File.basename(cmd).split(' ').first] logfn = "#{logd}/%02d.%s" % [@exec_count, File.basename(cmd).split(' ').first]
mkdir_p(logd) mkdir_p(logd)
rd, wr = IO.pipe
fork do fork do
ENV['HOMEBREW_CC_LOG_PATH'] = logfn ENV['HOMEBREW_CC_LOG_PATH'] = logfn
rd.close rd.close
@ -601,7 +601,7 @@ class Formula
end end
end end
ensure ensure
rd.close if rd and not rd.closed? rd.close unless rd.closed?
ENV.update(removed_ENV_variables) ENV.update(removed_ENV_variables)
end end