Skip to content

Instantly share code, notes, and snippets.

@doughazell
Last active September 2, 2016 15:09
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 doughazell/042ac3e8188f189282e757492072fa90 to your computer and use it in GitHub Desktop.
Save doughazell/042ac3e8188f189282e757492072fa90 to your computer and use it in GitHub Desktop.
Stopping Thin webserver after it's started via Rack::Server.start() in FnordMetric

##Forwarding signals arg passed to FnordMetric::Web Using gems 'fnordmetric-1.2.9' and 'thin-1.7.0', attempting to stop the Thin webserver using 'Ctrl-C ' after

FnordMetric::Web.new(port: 4242)

led to:

Stopping Thin ...
Thin was started inside an existing EventMachine.run block.
Call `EventMachine.stop` to stop the reactor and quit the process.
'~/.rvm/gems/ruby-2.2.2/gems/fnordmetric-1.2.9/lib/fnordmetric/web/web.rb':

class FnordMetric::Web
  def initialized
    ...
    Rack::Server.start(
      :app => dispatch,
      :server => server,
      :Host => host,
      :Port => port,

      # 30/8/16 DH: Allowing Ctrl-C to work with Thin recent versions
      :signals => @opts[:signals]
    )
  end
end

Then

FnordMetric::Web.new(port: 4242, signals: false)

allowed 'Ctrl-C ' to work.

Analytics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment