From: James Tucker <jftucker@gmail.com>
To: rack-devel@googlegroups.com
Subject: Re: ctrl-c not working in Rack::Handler::WEBrick
Date: Mon, 12 Jul 2010 16:44:05 +0100 [thread overview]
Message-ID: <A0908A8C-2EF5-41D6-957D-4F38157FE370@gmail.com> (raw)
In-Reply-To: <p06240804c86030f60735@[192.168.1.143]>
Stephen,
Please see my comments on the issue.
Handlers shouldn't contain traps, Rack::Server is responsible for that.
On 12 Jul 2010, at 03:48, Stephen Bannasch wrote:
> After this commit:
>
> http://github.com/rack/rack/commit/e516d89ffcdad1c9d58432aaaff4a382ed3997e7
>
> commit <a href="/rack/rack/commit/e516d89ffcdad1c9d58432aaaff4a382ed3997e7">e516d89</a>
> Author: raggi <jftucker@gmail.com>
> Date: Tue Mar 23 19:29:44 2010 +0000
>
> Move trap(:INT) to Rack::Server and support optional
> Handler protocol where handlers may implement .shutdown
> to do pre-exit cleanup.
>
> CTRL-C no longer works to shut down webrick.
>
> I've created an issue here: http://github.com/rack/rack/issues/#issue/35
>
> Here's a trivial rack app with a webrick handler that shows the problem:
>
> require 'rack'
> app = proc do |env|
> [200, { 'Content-Type' => 'text/html' }, 'hello from rack and webrick']
> end
> server = ::Rack::Handler::WEBrick
> server.run app, :Port => 3002
>
> Run this and try typing ctrl-c in the console:
>
> $ ruby hellorack.rb
> [2010-07-11 22:34:35] INFO WEBrick 1.3.1
> [2010-07-11 22:34:35] INFO ruby 1.9.1 (2010-01-10) [i386-darwin9.8.0]
> [2010-07-11 22:34:35] INFO WEBrick::HTTPServer#start: pid=82455 port=3002
> ^C[2010-07-11 22:34:37] ERROR Interrupt:
> /Users/stephen/.rvm/rubies/ruby-1.9.1-p378/lib/ruby/1.9.1/webrick/server.rb:90:in `select'
>
> An error is displayed but the program does not quit.
>
> In this simple example the code at lib/rack/server.rb:208 is never executed and
> no handler is actually registered for ctrl-c:
>
> trap(:INT) do
> if server.respond_to?(:shutdown)
> server.shutdown
> else
> exit
> end
> end
>
> Rack::Handler instances don't appear to be related to Rack::Server instances.
next prev parent reply other threads:[~2010-07-12 15:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-12 2:48 ctrl-c not working in Rack::Handler::WEBrick Stephen Bannasch
2010-07-12 15:44 ` James Tucker [this message]
2011-01-19 20:33 ` Alex Chaffee
2011-01-20 20:35 ` James Tucker
2011-01-21 18:56 ` Alex Chaffee
2011-01-21 19:47 ` James Tucker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://groups.google.com/group/rack-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A0908A8C-2EF5-41D6-957D-4F38157FE370@gmail.com \
--to=rack-devel@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).