Last active
August 1, 2017 13:18
-
-
Save sixtyfive/366507f48e045842fad774bc9bfe22d0 to your computer and use it in GitHub Desktop.
Example showing a Sinatra RuntimeError upon shutdown
This file contains hidden or 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
| require 'sinatra/base' | |
| class Application < Sinatra::Base | |
| get '/' do | |
| 'Hello World!' | |
| end | |
| end | |
| run Application.run! | |
| # A fix is to instead say | |
| # | |
| # run Application | |
| # | |
| # But then some of Sinatra's settings, such as the port, are not respected... |
This file contains hidden or 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
| $ rackup test.ru | |
| == Sinatra (v2.0.0) has taken the stage on 4567 for development with backup from Puma | |
| Puma starting in single mode... | |
| * Version 3.9.1 (ruby 2.2.6-p396), codename: Private Caller | |
| * Min threads: 0, max threads: 16 | |
| * Environment: development | |
| * Listening on tcp://localhost:4567 | |
| Use Ctrl-C to stop | |
| ^C== Sinatra has ended his set (crowd applauds) | |
| - Gracefully stopping, waiting for requests to finish | |
| === puma shutdown: 2017-08-01 15:02:08 +0200 === | |
| - Goodbye! | |
| /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:146:in `to_app': missing run or map statement (RuntimeError) | |
| from /home/jrs/Projects/wordcabin/test.ru:11:in `<main>' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:148:in `start' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/bin/rackup:4:in `<top (required)>' | |
| from /usr/bin/rackup:23:in `load' | |
| from /usr/bin/rackup:23:in `<main>' |
This file contains hidden or 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
| $ rackup test.ru | |
| [2017-08-01 15:10:33] INFO WEBrick 1.3.1 | |
| [2017-08-01 15:10:33] INFO ruby 2.2.6 (2016-11-15) [x86_64-linux] | |
| == Sinatra (v2.0.0) has taken the stage on 4567 for development with backup from WEBrick | |
| [2017-08-01 15:10:33] INFO WEBrick::HTTPServer#start: pid=12522 port=4567 | |
| ^C== Sinatra has ended his set (crowd applauds) | |
| [2017-08-01 15:10:37] INFO going to shutdown ... | |
| [2017-08-01 15:10:37] INFO WEBrick::HTTPServer#start done. | |
| /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:146:in `to_app': missing run or map statement (RuntimeError) | |
| from /home/jrs/Projects/wordcabin/test.ru:11:in `<main>' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `eval' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:49:in `new_from_string' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/builder.rb:40:in `parse_file' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:319:in `build_app_and_options_from_config' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:219:in `app' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:354:in `wrapped_app' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:283:in `start' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/lib/rack/server.rb:148:in `start' | |
| from /usr/lib64/ruby/gems/2.2.0/gems/rack-2.0.3/bin/rackup:4:in `<top (required)>' | |
| from /usr/bin/rackup:23:in `load' | |
| from /usr/bin/rackup:23:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment