|
This post originated from an RSS feed registered with Ruby Buzz
by James Britt.
|
Original Post: Simple Mousehole Hack
Feed Title: James Britt: Ruby Development
Feed URL: http://feeds.feedburner.com/JamesBritt-Home
Feed Description: James Britt: Playing with better toys
|
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by James Britt
Latest Posts From James Britt: Ruby Development
|
|
I've been running Mousehole, though I've not done anything too special quite yet. I've just started looking at the source, but I decided to make a few simple changes that, for me, make running Mousehole a bit nicer.
Out of the box (at least on Windows, running the readymade binary download), launching MH gives you an ever-present cmd shell window. This is the result of creating mousehole.exe using the default RubyScript2Exe settings.
However, you can tell RubyScript2Exe to use rubyw.exe rather than ruby.exe, which eliminates the visible shell window.
rubyscript2exe.rb mouseHole.rb --rubyscript2exe-rubyw
Now MH will run nicely in the background.
Ah, but now you can't stop it using Ctrl-C.
The next step is to tell MH to quit when it receives a special URL.
I added this to mousehole.rb:
server.mount_proc('/quit') do |req, resp| server.shutdown; exit; end
Now I can stop MH by calling
http://127.0.0.1:37004/quit
Read: Simple Mousehole Hack