From df1d27b037ad2415d0369a829701e290722a1a99 Mon Sep 17 00:00:00 2001 From: Jack Nagel Date: Sun, 3 Mar 2013 22:28:12 -0600 Subject: [PATCH] superenv/cc: keep exec monkeypatch out of Object --- Library/ENV/4.3/cc | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/Library/ENV/4.3/cc b/Library/ENV/4.3/cc index fb56a0581f..8bd7e6ad2e 100755 --- a/Library/ENV/4.3/cc +++ b/Library/ENV/4.3/cc @@ -21,18 +21,20 @@ def syspath %W{/usr /usr/local} end end -def exec *args - path = File.expand_path('~/Library/Logs/Homebrew/cc.log') - open(path, 'a') do |f| - f.print '[', $0 - f.print " -%s" % ENV['HOMEBREW_CCCFG'] if ENV['HOMEBREW_CCCFG'] - f.print '] ' - f.puts args.join(' ') - f.puts - end - Kernel.exec *args -end if ENV['HOMEBREW_LOG'] +module ExecLogExtension + def exec *args + path = File.expand_path('~/Library/Logs/Homebrew/cc.log') + open(path, 'a') do |f| + f.print '[', $0 + f.print " -%s" % ENV['HOMEBREW_CCCFG'] if ENV['HOMEBREW_CCCFG'] + f.print '] ' + f.puts args.join(' ') + f.puts + end + Kernel.exec *args + end +end class Cmd def initialize path, args @@ -206,6 +208,7 @@ if __FILE__ == $PROGRAM_NAME end ####################################################################### main + extend(ExecLogExtension) if ENV['HOMEBREW_LOG'] cmd = Cmd.new($0, ARGV) exec "xcrun", cmd.tool, *cmd.args end