Skip to content

Instantly share code, notes, and snippets.

@sorah
Created May 22, 2011 22:09
Show Gist options
  • Save sorah/985953 to your computer and use it in GitHub Desktop.
Save sorah/985953 to your computer and use it in GitHub Desktop.
diff --git a/lib/test/unit/parallel.rb b/lib/test/unit/parallel.rb
index e433779..dd10127 100644
--- a/lib/test/unit/parallel.rb
+++ b/lib/test/unit/parallel.rb
@@ -42,7 +42,11 @@ 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
+ end
MiniTest::Unit.output = orig_stdout
@@ -73,8 +77,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 +105,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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment