summaryrefslogtreecommitdiff
path: root/lib/test/unit
diff options
context:
space:
mode:
authorsorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-23 00:10:49 +0000
committersorah <sorah@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-23 00:10:49 +0000
commit6dc0488148c33fe3839e898e011178fa006fa87d (patch)
tree99aff43b6f5f7287b393a101107b122a5ec437df /lib/test/unit
parent1e13786700925d11ac6aad5fbff1e8bc4826054a (diff)
* lib/test/unit/parallel.rb: Never Ignore SIGINT. When received
Interrupt, immediately puts result and exit. [ruby-dev:43571] * lib/test/unit.rb: When received Interrupt, wait results from workers and correct them. [ruby-dev:43571] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31708 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit')
-rw-r--r--lib/test/unit/parallel.rb18
1 files changed, 15 insertions, 3 deletions
diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index e433779a2e..c5d07e673b 100644
--- a/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -42,7 +42,12 @@ module Test
e, f, s = @errors, @failures, @skips
- result = orig_run_suite(suite, type)
+ begin
+ result = orig_run_suite(suite, type)
+ rescue Interrupt
+ @need_exit = true
+ result = [nil,nil]
+ end
MiniTest::Unit.output = orig_stdout
@@ -73,8 +78,8 @@ module Test
process_args args
@@stop_auto_run = true
@opts = @options.dup
+ @need_exit = false
- Signal.trap(:INT,"IGNORE")
@old_loadpath = []
begin
@stdout = increment_io(STDOUT)
@@ -101,7 +106,14 @@ module Test
end
_run_suites MiniTest::Unit::TestCase.test_suites-suites, $2.to_sym
- @stdout.puts "ready"
+ if @need_exit
+ begin
+ @stdout.puts "bye"
+ rescue Errno::EPIPE; end
+ exit
+ else
+ @stdout.puts "ready"
+ end
when /^quit$/
begin
@stdout.puts "bye"