live-console icon indicating copy to clipboard operation
live-console copied to clipboard

1.9.2: undefined method `external_encoding' for nil:NilClass

Open rkumar opened this issue 14 years ago • 2 comments

Using 1.9.2: when i connect netcat, i keep getting an exception:

undefined method external_encoding' for nil:NilClass /Users/rahul/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/irb/input-method.rb:70:inencoding' /Users/rahul/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/irb/ruby-lex.rb:242:in block (2 levels) in each_top_level_statement' /Users/rahul/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/irb/ruby-lex.rb:229:inloop' /Users/rahul/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/irb/ruby-lex.rb:229:in block in each_top_level_statement' /Users/rahul/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/irb/ruby-lex.rb:228:incatch' /Users/rahul/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/irb/ruby-lex.rb:228:in each_top_level_statement' /Users/rahul/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/irb.rb:155:ineval_input' /Users/rahul/.rvm/gems/ruby-1.9.2-head/gems/live_console-0.2.1/lib/live_console.rb:150:in block in start_with_io' /Users/rahul/.rvm/gems/ruby-1.9.2-head/gems/live_console-0.2.1/lib/live_console.rb:148:incatch' /Users/rahul/.rvm/gems/ruby-1.9.2-head/gems/live_console-0.2.1/lib/live_console.rb:148:in start_with_io' /Users/rahul/.rvm/gems/ruby-1.9.2-head/gems/live_console-0.2.1/lib/live_console.rb:70:inblock (2 levels) in start' /Users/rahul/.rvm/gems/ruby-1.9.2-head/gems/live_console-0.2.1/lib/live_console.rb:65:in loop' /Users/rahul/.rvm/gems/ruby-1.9.2-head/gems/live_console-0.2.1/lib/live_console.rb:65:inblock in start'

However, when i run in 1.8.7, it works. Could someone look into how to fix this for 1.9.x (I am on OSX Snow Leopard) Thanks, rkumar

rkumar avatar Nov 01 '10 08:11 rkumar

I commented out a line in irb to get the sample to work. I hope someone can fix live_console so irb does not need to be modified. thanks.

rkumar avatar Nov 01 '10 13:11 rkumar

For anyone else who faces the above problem when using 1.9.x, you can do the following in IRB:

ruby-lex.rb 242: @line.force_encoding(@io.encoding) 242: @line.force_encoding(@io.encoding) rescue "" # ADDED RESCUE

Now it works. Thanks for the great utility.

rkumar avatar Nov 04 '10 06:11 rkumar