[Nitro] Telling WEBrick Nitro to kill itself

James Britt james_b at neurogami.com
Sun Sep 18 10:50:00 EDT 2005

George Moschovitis wrote:
 > Hm this is not supported at the moment. Moreover, I am not sure how
 > this could be implemented. Care to give some tips (or even better a
 > patch?).

There needs to be way to talk to the WEBrick server variable to issue it 
a shutdown command.

For example, in Mousehole, which is a WEBrick app,  I added this to my copy:

  server.mount_proc('/quit') do |req, resp| server.shutdown;  exit;  end

So I can now call

and mousehole goes away.

 > thanks,
 > -g.
 > PS: out of curiosity, where is this feature useful?

I sometimes run WEBrick Web apps on windows using rubyw.exe, which does 
not then allow for ctrl-C.  (Same behavior, I think, as following a 
command call with the ampersand on unix).  Simple Ruby services without 
having to have an annoying cmd window sitting around all day.

So I typically add in a way to send a request to the application to shut 
itself down.  Usually some special URL that maps to code that calls 


More information about the Nitro-general mailing list