Ruby on Rails在Windows XP上按CTRL+C在控制台,不会停止mongrel

时间:2021-12-03 00:24:22

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

我目前正在学习Ruby on Rails。我一直在关注学习Rails的播客和视频。

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.

我遇到了一个问题,更多的是麻烦。每次屏幕上的画面让我杀死mongrel服务器时,我不得不关闭控制台窗口,因为CTRL+C并没有像它应该的那样杀死它。然后,我必须打开一个新的控制台窗口,导航到我的rails应用程序,并发出一个“ruby脚本/服务器”命令来重新启动它。

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?

我所寻找的可能是一个原因,一种修复它或其他建议的方法,使这个过程更快和/或更不恼人。或者可能是一个批处理文件或快捷方式来打开cmd窗口到我需要它的地方?

9 个解决方案

#1


40  

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

使用Ctrl +暂停/休息。它将停止服务器。

Ruby on Rails在Windows XP上按CTRL+C在控制台,不会停止mongrel

#2


10  

Ctrl+Pause/Break force closes the server. It's not normal. Anyways my Dell notebook does not have the key.

Ctrl+Pause/Break force关闭服务器。这不是正常的。不管怎样,我的戴尔笔记本电脑没有钥匙。

So use this:
instead of rails s use ruby script/rails s.
Ctrl+C will work perfectly with that. Tested it.

使用这个:使用ruby脚本/rails s而不是rails s。测试它。

#3


2  

It's a known issue and here is the patch:https://rails.lighthouseapp.com/projects/8994/tickets/2088-mongrel-not-being-stopped-with-ctrl-c-under-windows

这是一个已知的问题,这里有一个补丁:https://rails.lighthouseapp.com/projects/8994/tickets/2088-mongrel-not- stop -ctrl-c- windows。

#4


1  

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.

我相信,如果你抓住了一个例外,而不是再提出它,这种情况就会发生。sigi - int将被捕获,最终不会终止进程。

#5


1  

If all fails, hit Ctrl+Alt+Delete, open the task manager and just kill the ruby process ;) Ruby on Rails在Windows XP上按CTRL+C在控制台,不会停止mongrel

如果一切都失败了,按Ctrl+Alt+Delete,打开任务管理器,关闭ruby进程;

#6


0  

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.

我在Windows上也有同样的问题,所以无法帮助您解决Ctrl+C问题。但是,我可以在这里指向Windows PowerToys的Open Command窗口——它在您的Explorer窗口中添加了“Open Command Window Here”,这是Windows机器上开发(任何类型)的需求。

#7


0  

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

你可以在这里得到更多的信息。这可能是有趣的:作为服务的杂种

#8


0  

After you hit Ctrl+c, send a request to the server by refreshing your browser page where you had it open. The command prompt will now say Exiting and let you back to the command line.

单击Ctrl+c后,通过刷新打开的浏览器页面向服务器发送请求。命令提示符现在会说退出并让您回到命令行。

#9


0  

Check your rails version and use

检查您的rails版本和使用。

ctrl+c+pause/break for 2.3.2
ctrl+c for 2.1.2

ctrl+c+暂停/中断2。3.2 ctrl+c暂停2。2

#1


40  

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

使用Ctrl +暂停/休息。它将停止服务器。

Ruby on Rails在Windows XP上按CTRL+C在控制台,不会停止mongrel

#2


10  

Ctrl+Pause/Break force closes the server. It's not normal. Anyways my Dell notebook does not have the key.

Ctrl+Pause/Break force关闭服务器。这不是正常的。不管怎样,我的戴尔笔记本电脑没有钥匙。

So use this:
instead of rails s use ruby script/rails s.
Ctrl+C will work perfectly with that. Tested it.

使用这个:使用ruby脚本/rails s而不是rails s。测试它。

#3


2  

It's a known issue and here is the patch:https://rails.lighthouseapp.com/projects/8994/tickets/2088-mongrel-not-being-stopped-with-ctrl-c-under-windows

这是一个已知的问题,这里有一个补丁:https://rails.lighthouseapp.com/projects/8994/tickets/2088-mongrel-not- stop -ctrl-c- windows。

#4


1  

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.

我相信,如果你抓住了一个例外,而不是再提出它,这种情况就会发生。sigi - int将被捕获,最终不会终止进程。

#5


1  

If all fails, hit Ctrl+Alt+Delete, open the task manager and just kill the ruby process ;) Ruby on Rails在Windows XP上按CTRL+C在控制台,不会停止mongrel

如果一切都失败了,按Ctrl+Alt+Delete,打开任务管理器,关闭ruby进程;

#6


0  

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.

我在Windows上也有同样的问题,所以无法帮助您解决Ctrl+C问题。但是,我可以在这里指向Windows PowerToys的Open Command窗口——它在您的Explorer窗口中添加了“Open Command Window Here”,这是Windows机器上开发(任何类型)的需求。

#7


0  

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

你可以在这里得到更多的信息。这可能是有趣的:作为服务的杂种

#8


0  

After you hit Ctrl+c, send a request to the server by refreshing your browser page where you had it open. The command prompt will now say Exiting and let you back to the command line.

单击Ctrl+c后,通过刷新打开的浏览器页面向服务器发送请求。命令提示符现在会说退出并让您回到命令行。

#9


0  

Check your rails version and use

检查您的rails版本和使用。

ctrl+c+pause/break for 2.3.2
ctrl+c for 2.1.2

ctrl+c+暂停/中断2。3.2 ctrl+c暂停2。2