From: Shane Liesegang Date: 2007-08-27T23:46:05+09:00 Subject: Re: IRB module with non-blocking asynchronous gets Hi James. Thanks for the recommendations. James Gray wrote: > > Is that what you are after? If it is, do we really need IRb at all? > How's this: I could just use eval to run the strings; that's true. I was hoping to leverage IRB's prompt mechanism and the ability to define functions on the fly. As below: ----- irb(main):001:0> def test irb(main):002:1> puts "testing..." irb(main):003:1> end => nil irb(main):004:0> test testing... => nil irb(main):005:0> ----- I'm finding that it's pretty tricky, though. I managed to make it non-blocking for a single line by overriding eval_input and having it break after evaluating a line instead of waiting for input. That seems to work fine, but when doing any kind of multi-line input, it still goes into a loop that it doesn't want to return from. It seems like IRB, to its core, is based on constantly waiting for input, and trying to make it work in an on-demand fashion is like running uphill. I'm still rooting through its source, trying to find the spots where I can poke at it to make it work that way, but it's slow going with a large mass of interrelated code that's not terribly easy for humans to parse. :-) -- Posted via http://www.ruby-forum.com/.