summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-03 10:00:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-03 10:00:49 +0000
commit1d339ff212747d5bcd4fcbf65750f078c64c7367 (patch)
tree29d9bd6c991ef4b47c2ad78f42f4c648393eccf1 /ext
parent9089f57207b2f6ff9a48bc50b1ea67c92b17895e (diff)
* ext/extmk.rb (extmake): Use Logging.open to switch stdout and
stderr. Delay Logging::log_close until the failure message is written. Write the failure message only if log file is opened. * lib/mkmf.rb (Logging.log_opened?): New method. [ruby-dev:47215] [Bug #8209] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40080 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rwxr-xr-xext/extmk.rb20
1 files changed, 7 insertions, 13 deletions
diff --git a/ext/extmk.rb b/ext/extmk.rb
index 659d33ba0d..737e998b28 100755
--- a/ext/extmk.rb
+++ b/ext/extmk.rb
@@ -193,19 +193,11 @@ def extmake(target)
Logging::logfile 'mkmf.log'
rm_f makefile
if conf
- stdout = $stdout.dup
- stderr = $stderr.dup
- unless verbose?
- $stderr.reopen($stdout.reopen(@null))
- end
- begin
+ Logging.open do
+ unless verbose?
+ $stderr.reopen($stdout.reopen(@null))
+ end
load $0 = conf
- ensure
- Logging::log_close
- $stderr.reopen(stderr)
- $stdout.reopen(stdout)
- stdout.close
- stderr.close
end
else
create_makefile(target)
@@ -235,11 +227,13 @@ def extmake(target)
mess = "#{error}\n#{mess}"
end
- Logging::message(mess)
+ Logging::message(mess) if Logging.log_opened?
print(mess)
$stdout.flush
+ Logging::log_close
return true
end
+ Logging::log_close
args = sysquote($mflags)
unless $destdir.to_s.empty? or $mflags.defined?("DESTDIR")
args += [sysquote("DESTDIR=" + relative_from($destdir, "../"+prefix))]