Browse files

It runs *once*.

  • Loading branch information...
1 parent 65e2cbb commit 14f2882ca548b734207eed9d67b9175151de9810 tailor committed Feb 12, 2008
Showing with 9 additions and 12 deletions.
  1. +1 −1 doc/lc_example.rb
  2. +8 −11 lib/live_console.rb
View
2 doc/lc_example.rb
@@ -1,6 +1,6 @@
#!/usr/bin/env ruby
-require 'rubygems'
+#require 'rubygems'
require 'live_console'
print <<-EOF
View
19 lib/live_console.rb
@@ -29,11 +29,13 @@ class LiveConsole
#
# Creates a new LiveConsole. You must next call LiveConsole#run when you
# want to spawn the thread to accept connections and run the console.
- def initialize(io_method = :socket, opts = {})
- unless IOMethods::List.include?(io_method.to_sym)
+ def initialize(io_method, opts = {})
+ self.io_method = io_method.to_sym
+ unless IOMethods::List.include?(self.io_method)
raise ArgumentError, "Unknown IO method: #{io_method}"
end
+ self.io_method
init_io opts
end
@@ -44,15 +46,10 @@ def run
return false if lc_thread
self.lc_thread = Thread.new {
loop {
- socket = nil
- begin
- Thread.pass
- io.start
- IRB.start_with_io(io.raw)
- rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO,
- Errno::EINTR
- io.stop
- retry
+ Thread.pass
+ if io.start
+ irb_io = GenericIOMethod.new io.raw
+ IRB.start_with_io(irb_io)
end
}
}

0 comments on commit 14f2882

Please sign in to comment.