Last active
December 10, 2015 10:59
-
-
Save jleo3/4424479 to your computer and use it in GitHub Desktop.
SIGINT causes an exception when executing with Ruby 2.0 but not with Ruby 1.9.3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment