playing around with showing the list of untested files when the user hits ctrl-c

This commit is contained in:
Sean Kirby 2010-05-07 19:15:14 -04:00
parent 133ad90894
commit 7f8e573fb9
2 changed files with 15 additions and 1 deletions

View File

@ -29,6 +29,17 @@ module Hydra #:nodoc:
# * :autosort
# * Set to false to disable automatic sorting by historical run-time per file
def initialize(opts = { })
#at_exit do
trap("SIGINT") do
begin
puts "Testing halted by user. Untested files:"
puts @incomplete_files.join("\n")
#shutdown_all_workers
rescue
puts $!.inspect
puts $!.backtrace.join("\n")
end
end
opts.stringify_keys!
config_file = opts.delete('config') { nil }
if config_file
@ -155,6 +166,7 @@ module Hydra #:nodoc:
worker[:io].close if worker[:io]
end
@listeners.each{|t| t.exit}
trace "Workers shut down"
end
def process_messages

View File

@ -14,7 +14,7 @@ module Hydra #:nodoc:
return Message.build(eval(message.chomp))
rescue SyntaxError, NameError
# uncomment to help catch remote errors by seeing all traffic
#$stderr.write "Not a message: [#{message.inspect}]\n"
$stderr.write "Not a message: [#{message.inspect}]\n"
return gets
end
@ -26,6 +26,8 @@ module Hydra #:nodoc:
raise UnprocessableMessage unless message.is_a?(Hydra::Message)
@writer.write(message.serialize+"\n")
rescue Errno::EPIPE
$stderr.write $!.inspect
$stderr.write $!.backtrace.join("\n")
raise IOError
end