Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails won't exit on first CTRL-C

No Rails command will exit on the first CTRL-C. So rails s or rails c require me to hit control CTRL-C a second time and commands that previously wouldn't have required a CTRL-C at all such as rake routes / db:migrate now require me to press it.

The issue is not happening for any of my teammates. I'm on OSX using iTerm2. There are no instances of 'rescue Exception' in the app.

I've just reinstalled mysql using brew and the issue is still present. Rails version 4.0.5 and sql server version 5.6.27. Any idea where the issue might be?

[2016-01-13 16:18:33] INFO  WEBrick 1.3.1
[2016-01-13 16:18:33] INFO  ruby 2.1.2 (2014-05-08) [x86_64-darwin13.0]
[2016-01-13 16:18:33] INFO  WEBrick::HTTPServer#start: pid=2329 port=3000
^C[2016-01-13 16:18:54] INFO  going to shutdown ...
[2016-01-13 16:18:54] INFO  WEBrick::HTTPServer#start done.
Exiting
^C
like image 243
zach Avatar asked Jan 06 '16 02:01

zach


2 Answers

Honestly Webrick 1.3.1 was released in December 28, 2011 I would suggest moving away from this see webrick answer for the reasons.

As you have said that it happens in rails consoles and other tasks (You should really put this in the question as it helps with debugging) I would suggest it is a gem that is causing this (You should update your rails version anyway) but I would suggest using:

Ctrl-D

This should exit you straight away

like image 185
Jesse Whitham Avatar answered Oct 17 '22 06:10

Jesse Whitham


I suspect this isn't as much an answer as a suggestion, but I started using Puma by default in my projects a while back, and given that Rails 5 is moving to Puma by default it may not be a bad suggestion.

I use a similar environment, OS X 10.11.2, iTerm 2, tmux, etc. I can't recall when or what prompted it, but at some point my WEBrick projects started behaving this same way, and I started moving them to Puma where possible which didn't seem to show the same behavior.

I know that doesn't really give a clear answer as to what's causing the issue, but also, I too know it's not system performance related.

like image 41
codeurge Avatar answered Oct 17 '22 07:10

codeurge