ruby-changes:24243
From: nobu <ko1@a...>
Date: Wed, 4 Jul 2012 06:21:39 +0900 (JST)
Subject: [ruby-changes:24243] nobu:r36293 (trunk): bootstraptest: no stderr output
nobu 2012-07-04 06:19:52 +0900 (Wed, 04 Jul 2012) New Revision: 36293 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36293 Log: bootstraptest: no stderr output * bootstraptest/runner.rb (assert_check): capture stderr and ensure nothing is output. Modified files: trunk/bootstraptest/runner.rb Index: bootstraptest/runner.rb =================================================================== --- bootstraptest/runner.rb (revision 36292) +++ bootstraptest/runner.rb (revision 36293) @@ -223,8 +223,9 @@ def assert_check(testsrc, message = '', opt = '') show_progress(message) { - result = get_result_string(testsrc, opt) + result, errout = with_stderr {get_result_string(testsrc, opt)} check_coredump + error "stderr output is not empty\n", adjust_indent(errout) unless errout.empty? yield(result) } end @@ -396,6 +397,23 @@ end end +def with_stderr + out = err = nil + IO.pipe do |r, w| + stderr = $stderr.dup + $stderr.reopen(w) + w.close + reader = Thread.start {r.read} + begin + out = yield + ensure + $stderr.reopen(stderr) + err = reader.value + end + end + return out, err +end + def newtest @location = File.basename(caller(2).first) @count += 1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/