Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sinatra requires CTRL+C twice to shutdown #5

Closed
shreeve opened this issue Mar 16, 2010 · 5 comments
Closed

Sinatra requires CTRL+C twice to shutdown #5

shreeve opened this issue Mar 16, 2010 · 5 comments

Comments

@shreeve
Copy link
Contributor

shreeve commented Mar 16, 2010

When I ran a small sinatra app, I have to press CTRL+C twice to get it to shutdown.

== Sinatra/1.0.b has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
^C>> Stopping ...

== Sinatra has ended his set (crowd applauds)
== Sinatra/1.0.b has taken the stage on 4567 for development with backup from Thin
>> Thin web server (v1.2.7 codename No Hup)
>> Maximum connections set to 1024
>> Listening on 0.0.0.0:4567, CTRL+C to stop
^C>> Stopping ...

== Sinatra has ended his set (crowd applauds)

I'm currently running:

ubuntu 9.10 (karmic)
rubygems 1.3.6
ruby 1.9.1p376 (2009-12-07 revision 26041) [i486-linux]
sinatra 1.0.b
thin 1.2.7

@tbuehlmann
Copy link
Contributor

Happens for me when starting a class style application with Application.run in the config.ru, for example.

@bruno-c
Copy link

bruno-c commented Mar 24, 2010

This used to happen to me before under Cygwin. Definitely has to do with how you start the application and the content of your rackup file. What I do is:

yourapp.rb
class App < Sinatra:Base
whatev..
end

config.ru
require 'rubygems'
require 'yourapp.rb'
run App

and finally, start the app using a batch file or from your shell prompt:

rackup -s thin config.ru

@sr
Copy link
Member

sr commented Jul 10, 2010

I couldn't reproduce on 1.0. Please re-open if this is still an issue. Thanks

@AndrewHartAR
Copy link

I'm getting this issue. My code can be simplified down to this, and still produces the issue:

require 'sinatra'

class MyServer < Sinatra::Base
  get '/test' do
    'Hello world!'
  end

  run! if app_file == $0
end

I'm running in the terminal with ruby my_server.rb. If I remove the run line, then it only requires ctrl+c once to shutdown, but the endpoint doesn't get called, instead displaying this error:

[28/May/2016:20:37:15 +0100] "GET /test HTTP/1.1" 404 466 0.0005

@AndrewHartAR
Copy link

It's because I imported sinatra, instead of sinatra/base

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants