Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
38 lines (30 sloc) 961 Bytes
#!/usr/bin/env ruby
require 'rubygems'
require 'live_console'
default_path = "/tmp/lc_example_#{Process.uid}.sock"
print <<-EOF
This is a demo program for LiveConsole. It starts a LiveConsole at the
specified path, and you can connect to it by using netcat or telnet to connect
to the specified port.
#{$0} [path_to_socket [value_for_$x]]
The default path is #{default_path}, and $x is set by default to nil.
Run this program, and then in a different terminal, connect to it via
the supplied udscat program or the BSD version of netcat.
path = ARGV.first
path = path.nil? ? default_path : path
$x = ARGV[1]
lc = :unix_socket, :path => path
puts "My PID is #{}, " \
"I'm running on #{path}, and $x = #{$x.inspect}"
oldx = $x
loop {
if $x != oldx
puts "The time is now #{'%R:%S')}.",
"The value of $x changed from #{oldx.inspect} to #{$x.inspect}."
oldx = $x
sleep 1
Jump to Line
Something went wrong with that request. Please try again.