问题
Normally when I run a rails app from the console during development I can just press Ctrl + C and it exits. Then I can run the app again, thus bouncing it and effecting changes.
I am running a sinatra app. I just run the ruby file.
$: ruby myapp.rb
When I press Ctrl+C, however, it won't stop the app. I've had to bring up the Ubuntu System Monitor and kill the Ruby process. Very annoying.
Anyone seen this/dealt with this before?
回答1:
I installed the 'thin' gem and it works fine.
Apparently sinatra + Webrick is unstoppable.
(Also, running Ubuntu 11.04.)
回答2:
Try the exit
method, which should exit you out of the Sinatra Irb according to the following reference:
http://sinatra.rubyforge.org/doc/classes/Sinatra/Irb.html#M000029
来源:https://stackoverflow.com/questions/5900102/ctrlc-wont-stop-a-sinatra-app