IRB with completion


(Kent S) #1

IRB process dies when doing code completion in these cases:

$ irb -r irb/completion
irb(main):001:0> class Test
irb(main):002:1> undef :methods
irb(main):003:1> end
=> nil
irb(main):004:0> t = Test.new
=> #Test:0x32afe4
irb(main):005:0> t./usr/local/lib/ruby/1.9/irb/completion.rb:129:in
eval': undefined methodmethods’ for #Test:0x32afe4 (NoMethodError)
from /usr/local/lib/ruby/1.9/irb/workspace.rb:52:in `irb_binding’
from /usr/local/lib/ruby/1.9/irb/workspace.rb:52

$ irb -r irb/completion
irb(main):001:0> class Test
irb(main):002:1> def methods
irb(main):003:2> :blah
irb(main):004:2> end
irb(main):005:1> end
=> nil
irb(main):006:0> t = Test.new
=> #Test:0x328f28
irb(main):007:0> t./usr/local/lib/ruby/1.9/irb/completion.rb:171:in
select_message': undefined methodgrep’ for :blah:Symbol (NoMethodError)
from /usr/local/lib/ruby/1.9/irb/completion.rb:148
from /usr/local/lib/ruby/1.9/irb/completion.rb:37:in call' from /usr/local/lib/ruby/1.9/irb/input-method.rb:134:inreadline’
from /usr/local/lib/ruby/1.9/irb/input-method.rb:134:in gets' from /usr/local/lib/ruby/1.9/irb.rb:130:ineval_input’
from /usr/local/lib/ruby/1.9/irb.rb:129:in signal_status' from /usr/local/lib/ruby/1.9/irb.rb:129:ineval_input’
from /usr/local/lib/ruby/1.9/irb.rb:128:in call' ... 12 levels... from /usr/local/lib/ruby/1.9/irb.rb:70:instart’
from /usr/local/lib/ruby/1.9/irb.rb:69:in catch' from /usr/local/lib/ruby/1.9/irb.rb:69:instart’
from /usr/local/bin/irb:13

I think IRB::InputCompletor::CompletionProc should digest these
exceptional cases and warn user about possible problem.

/kent