Skip to content

Instantly share code, notes, and snippets.

@jleo3
Last active December 10, 2015 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jleo3/4424479 to your computer and use it in GitHub Desktop.
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.
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