From d55cd34ba8680310fb07c2f5c1c6a27b4902865d Mon Sep 17 00:00:00 2001 From: eregon Date: Thu, 29 Jun 2017 14:35:09 +0000 Subject: Update to ruby/mspec@021a119 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- spec/mspec/lib/mspec/commands/mspec.rb | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'spec/mspec/lib/mspec/commands/mspec.rb') diff --git a/spec/mspec/lib/mspec/commands/mspec.rb b/spec/mspec/lib/mspec/commands/mspec.rb index d3edb4d51e..cb1c0fbacb 100755 --- a/spec/mspec/lib/mspec/commands/mspec.rb +++ b/spec/mspec/lib/mspec/commands/mspec.rb @@ -114,6 +114,7 @@ class MSpecMain < MSpecScript puts children.map { |child| child.gets }.uniq formatter.start + last_files = {} until @files.empty? IO.select(children)[0].each { |io| @@ -127,22 +128,33 @@ class MSpecMain < MSpecScript while chunk = (io.read_nonblock(4096) rescue nil) reply += chunk end - raise reply + reply.chomp!('.') + msg = "A child mspec-run process printed unexpected output on STDOUT" + if last_file = last_files[io] + msg += " while running #{last_file}" + end + abort "\n#{msg}: #{reply.inspect}" + end + + unless @files.empty? + file = @files.shift + last_files[io] = file + io.puts file end - io.puts @files.shift unless @files.empty? } end - ok = true + success = true children.each { |child| child.puts "QUIT" - Process.wait(child.pid) - ok &&= $?.success? + _pid, status = Process.wait2(child.pid) + success &&= status.success? + child.close } formatter.aggregate_results(output_files) formatter.finish - ok + success end def run @@ -152,7 +164,7 @@ class MSpecMain < MSpecScript argv.concat config[:flags] argv.concat config[:loadpath] argv.concat config[:requires] - argv << "#{MSPEC_HOME}/bin/mspec-#{ config[:command] || "run" }" + argv << "#{MSPEC_HOME}/bin/mspec-#{config[:command] || 'run'}" argv.concat config[:options] if config[:multi] -- cgit v1.2.3