views:

865

answers:

6

I am currently in the process of learning Ruby on Rails. I have been following the Learning Rails podcast and screencasts.

I've run into a problem, well more of an annoyance. Every time the screencast has me kill the mongrel server I am forced to close the console window because CTRL+C isnt killing it as it should. I then have to open a new console window, navigate to my rails app and issue a 'ruby script/server' command to restart it.

What I am looking for is possibly a reason for this, a way to fix it or other suggestions to make this process faster and/or less annoying. Or even possibly a batch file or shortcut to open a cmd window right to where I need it?

A: 

I have the same problem on Windows as well, so can't help you in fixing the Ctrl+C issue. But, I can point you towards Windows PowerToys' Open Command Window Here - it adds "Open Command Window Here" to your Explorer window, it's a requirement for development (of any sort) on Windows machines.

Michael Wales
Well, thats definitely a start. I can't imagine we are the only two people on SO that have used Rails on windows and have a problem with CTRL+C killing the server.
Jayrox
I use windows (xp) and have no problem killing my server.
srboisvert
A: 

If you start mongrel a little different like this:

$ cd myrailsapp
$ mongrel_rails start

then you can stop it like this:

$ mongrel_rails stop

You can get more info here. This might be interesting to: Mongrel as a service

dertoni
+1  A: 

I believe this can happen if you are catching Exception and not re raising it. SIG-INT would be caught there and ultimately not kill the process.

Kyle Boon
how can i check if this is happening. i know i did not explicitly add an exception catch for SIG-INT or any other exception (yet) as I am just following a basic tutorial
Jayrox
Just search your project for "rescue Exception".
Bob Aman
+4  A: 

Use Ctrl+Pause/Break instead. It will stop the server.

thanks, i'll give that a try
Jayrox
I ran into this problem too. Ctrl+Pause/Break worked wonderfully. This seems to be a new issue with rails 2.3.2. I just upgraded from 2.1.1. If I change my environment to 2.3.2 Ctrl+C doesn't work, change it back to 2.2.2, works great.
Tilendor
A: 

check your rails version and use ctrl+c+paus/breal for 2.3.2

ctrl+c for 2.1.2

hira