LiveConsole 0.2.0, a window into your running program

Hey, uh, here’s a long-overdue new release of LiveConsole. If you’ve
never heard of it, it is a library for providing IRB over a TCP or Unix
socket so that you can interact with a running application. It’s useful
for debugging, for hot-patching code that you don’t want to interrupt,
for interactive monitoring, and for looking cool. The new version is
0.2.0, and contains a few API changes to accomodate the new capabilites:

  • Unix Domain Socket support (Works under Linux and OS X,
    apparently; not likely to work under Windows)
  • The ability to supply bindings to LiveConsole
  • A program for interacting with the Unix socket (installed in
    your bin directory as udscat), as some versions of netcat
    don’t include this functionality.

There are two example programs in the doc directory, and a README. It
should be pretty simple to operate, though, as there are only three
methods (LiveConsole.new, LiveConsole#start, and LiveConsole#stop) that
are important for most uses.

For the impatient:

Run a LiveConsole with IRB bound to the toplevel:

lc = LiveConsole.new :socket, :port => 30303
lc.start

Note that we bind to localhost by default, so you can only

connect to this from the same machine that is running it.

Fire up a second terminal, and

you@your-box:~$ netcat localhost 30303
irb(main):001:0> puts “Hello, world!”
=> nil

This shows up in the terminal of the program that created the

LiveConsole:

Hello, world!

Run a LiveConsole for the current process, and pass it the

local binding (Unix only):

lc = LiveConsole.new :unix_socket, :path => ‘/tmp/live-console.sock’,
:bind => binding
lc.start

Fire up a second terminal, and

you@your-box:~$ udscat /tmp/live-console.sock
irb(main):001:0> local_variables
=> [“_”, “lc”]
irb(main):002:0> puts “Hello, world!”
=> nil

Similar results, except that we’ve exposed the binding, so you

can see local variables in caller, including the instance of

lc. (Try re-starting it, just for fun.) See the example code

or the README for details.

Installation:

gem install live_console

For the non-impatient:

Have a look at Debu.gs: LiveConsole . There is also a
Rubyforge site at http://rubyforge.org/projects/live-console .