问题
For some reason, when I type "rails s", sometimes I can't shut the server down using CTRL-C. It's using Web brick, the default.
Sometimes it works for hours. Other times it doesn't work at all and I must constantly kill the process if I want to shut down the server.
Is this a known problem? How can I fix it?
If you need to know more info, please just ask and I'll tell you what I can. Because I don't know what is causing it, I am at a loss as to what info to provide you with.
EDIT: I am adding a git repository:
gem 'rails-dev-boost', :git => 'git://github.com/thedarkone/rails-dev-boost.git', :require => 'rails_development_boost'
But to be fair, I've not had this problem with this line enabled... and I've also had this problem when this gem line didn't exist.
回答1:
The way I solved this problem was to do the following:
To stop the rails server
while it's running, press:
CTRL-C
CTRL-Z
You will get control back to bash
. Then type (without the $):
$ fg
And this will go back into the process, and then quit out of Rails s
properly.
It's a little annoying, but this sure beats killing the process manually. It's not too bad and it's the best I could figure out.
回答2:
This is a kernel bug that affects Ubuntu 11.04 (it's fixed in 11.10, fwiw). You can install kernel 2.6.39 to fix it.
I'm using the xorg-edgers PPA which includes 2.6.39, and I don't experience the issue.
来源:https://stackoverflow.com/questions/6086601/using-ubuntu-11-04-i-cant-shut-down-rails-server-using-ctrl-c