The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Simple Mousehole Hack

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
James Britt

Posts: 1319
Nickname: jamesbritt
Registered: Apr, 2003

James Britt is a principal in 30 Second Rule, and runs ruby-doc.org and rubyxml.com
Simple Mousehole Hack Posted: Sep 4, 2005 9:38 AM
Reply to this message Reply

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

Advertisement

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

Topic: Upgraded to Typo trunk Previous Topic   Next Topic Topic: The Lately Hoodwink'd

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use