public
Last active

SIGINT causes an exception when executing with Ruby 2.0 but not with Ruby 1.9.3.

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
class MyServer < GServer
end
 
class Launcher
def initialize(servers)
@servers = servers
end
def start
@servers.each { |server| server.start }
end
def join
@servers.each { |server| server.join }
end
def stop
@servers.each { |server| server.stop }
end
end
launcher = Launcher.new(servers) // where servers is a collection of my_server
launcher.start
trap("SIGINT") { launcher.stop; exit }
launcher.join

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.