Reduce effective scope of pipe variables

This commit is contained in:
Jack Nagel 2014-09-05 15:13:52 -05:00
parent 659896fda2
commit 479ad0265b

View File

@ -493,8 +493,6 @@ class Formula
# Pretty titles the command and buffers stdout/stderr
# Throws if there's an error
def system cmd, *args
rd, wr = IO.pipe
# 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
pretty_args = args.dup
@ -510,6 +508,9 @@ class Formula
logfn = "#{logd}/%02d.%s" % [@exec_count, File.basename(cmd).split(' ').first]
mkdir_p(logd)
rd, wr = IO.pipe
begin
pid = fork { exec_cmd(cmd, args, rd, wr, logfn) }
wr.close
@ -544,6 +545,7 @@ class Formula
ensure
rd.close unless rd.closed?
end
end
private