It's not intentional but it doesn't appear to be specific to TCS Ruby.
On my Win7 32bit, running `ruby script\rails server` and Ctrl+C worked for me on a new, empty rails project but `rails server` and Ctrl+C didn't work.
C:\rails-empty>ruby --version
tcs-ruby 1.9.3p134 (2012-02-19, TCS patched 2012-02-25) [i386-mingw32]
C:\rails-empty>ruby script\rails s
=> Booting WEBrick
=> Rails 3.2.2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-03-09 13:10:57] INFO WEBrick 1.3.1
[2012-03-09 13:10:57] INFO ruby 1.9.3 (2012-02-19) [i386-mingw32]
[2012-03-09 13:10:57] INFO WEBrick::HTTPServer#start: pid=5288 port=3000
[2012-03-09 13:11:00] INFO going to shutdown ...
[2012-03-09 13:11:00] INFO WEBrick::HTTPServer#start done.
Exiting
On a plain vanilla Ruby `rails server` and Ctrl+C doesn't work for me and I'm stuck at:
C:\rails-empty>ruby --version
ruby 1.9.3p163 (2012-03-06 revision 34932) [i386-mingw32]
C:\rails-empty>rails server
=> Booting WEBrick
=> Rails 3.2.2 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-03-09 13:16:33] INFO WEBrick 1.3.1
[2012-03-09 13:16:33] INFO ruby 1.9.3 (2012-03-06) [i386-mingw32]
[2012-03-09 13:16:33] INFO WEBrick::HTTPServer#start: pid=4624 port=3000
Jon
Haven't tried newer versions, but with thin or eventmachine used to happen to me
Will check osx and windows later today also trunk.
Sorry for top posting. Sent from mobile.
Until this issue is resolved, just a side note that Ctrl+Break works.
>> `rails server` and Ctrl+C didn't work.
>
> Until this issue is resolved, just a side note that Ctrl+Break works.
I've long had the same in 1.8.7, mongrel but IIRC 1.9.3 (webbrick) was fine.
James.
On my Dell Studio with no Break/Pause, Ctrl+Fn+F12 seems to work with `rails s [thin]` and `ruby script\rails s [thin]`.
EventMachine calls HookControlC() in emwin.cpp, which disables Ctrl+C
in app that are using em (like thin).
EM should use something like SetConsoleCtrlHandler(MyBreakHandler,
TRUE) which setes gTerminateSignalReceived to true and gracefully
terminates.
Hello,
doing "ruby script\rails server" works as expected:
https://gist.github.com/248cdd9d566d53620e86
However, all the builds (disregard of TCS or RubyInstaller) suffer the
same Ctrl+C issue of "rails server"
The culprit is Kernel#exec, which is used by "rails" script to
transfer control to the child process.
When you do "rails server" it is actually invoking exec with "ruby
script\rails server" on your application directory.
A simple script that recreates the following issue:
https://gist.github.com/2009356
Now run "ruby a.rb" and will see that no matter how much you hit
Ctrl+C, nothing happens.
I think this should be reported to Ruby-Core.
--
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
Reported:
http://bugs.ruby-lang.org/issues/6131
I think Luis (a ruby-core committer) was suggesting that (a) you've discovered a real issue, and (b) you should report this as a bug https://bugs.ruby-lang.org/
FYI, a related reason (performance) why you might want to use `ruby script\rails` http://jstorimer.com/2011/12/20/rails-and-exec.html
Jon
---
Fail fast. Fail often. Fail publicly. Learn. Adapt. Repeat.
http://thecodeshop.github.com | http://jonforums.github.com/
twitter: @jonforums