Extract body of child process to a method
This commit is contained in:
parent
bbf79f5d85
commit
659896fda2
@ -510,29 +510,7 @@ 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)
|
||||||
|
|
||||||
pid = fork do
|
pid = fork { exec_cmd(cmd, args, rd, wr, logfn) }
|
||||||
ENV['HOMEBREW_CC_LOG_PATH'] = logfn
|
|
||||||
|
|
||||||
# TODO system "xcodebuild" is deprecated, this should be removed soon.
|
|
||||||
if cmd.to_s.start_with? "xcodebuild"
|
|
||||||
ENV.remove_cc_etc
|
|
||||||
end
|
|
||||||
|
|
||||||
# Turn on argument filtering in the superenv compiler wrapper.
|
|
||||||
# We should probably have a better mechanism for this than adding
|
|
||||||
# special cases to this method.
|
|
||||||
if cmd == "python" && %w[setup.py build.py].include?(args.first)
|
|
||||||
ENV.refurbish_args
|
|
||||||
end
|
|
||||||
|
|
||||||
rd.close
|
|
||||||
$stdout.reopen wr
|
|
||||||
$stderr.reopen wr
|
|
||||||
args.collect!{|arg| arg.to_s}
|
|
||||||
exec(cmd, *args) rescue nil
|
|
||||||
puts "Failed to execute: #{cmd}"
|
|
||||||
exit! 1 # never gets here unless exec threw or failed
|
|
||||||
end
|
|
||||||
wr.close
|
wr.close
|
||||||
|
|
||||||
File.open(logfn, 'w') do |f|
|
File.open(logfn, 'w') do |f|
|
||||||
@ -569,6 +547,30 @@ class Formula
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def exec_cmd(cmd, args, rd, wr, logfn)
|
||||||
|
ENV['HOMEBREW_CC_LOG_PATH'] = logfn
|
||||||
|
|
||||||
|
# TODO system "xcodebuild" is deprecated, this should be removed soon.
|
||||||
|
if cmd.to_s.start_with? "xcodebuild"
|
||||||
|
ENV.remove_cc_etc
|
||||||
|
end
|
||||||
|
|
||||||
|
# Turn on argument filtering in the superenv compiler wrapper.
|
||||||
|
# We should probably have a better mechanism for this than adding
|
||||||
|
# special cases to this method.
|
||||||
|
if cmd == "python" && %w[setup.py build.py].include?(args.first)
|
||||||
|
ENV.refurbish_args
|
||||||
|
end
|
||||||
|
|
||||||
|
rd.close
|
||||||
|
$stdout.reopen wr
|
||||||
|
$stderr.reopen wr
|
||||||
|
args.collect!{|arg| arg.to_s}
|
||||||
|
exec(cmd, *args) rescue nil
|
||||||
|
puts "Failed to execute: #{cmd}"
|
||||||
|
exit! 1 # never gets here unless exec threw or failed
|
||||||
|
end
|
||||||
|
|
||||||
def stage
|
def stage
|
||||||
active_spec.stage do
|
active_spec.stage do
|
||||||
@buildpath = Pathname.pwd
|
@buildpath = Pathname.pwd
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user