pry / pry-coolline

Live syntax-highlighting for the Pry REPL
Other
128 stars 17 forks source link

Abort rails console with `def method` #33

Closed maxiperezunlam closed 2 years ago

maxiperezunlam commented 8 years ago

Hello,

When define a method on rails console with name method close session with a abort message

def method
  puts "Hello Pry"
end

Abort message:

 output error: #<NoMethodError: private method `method' called for ":method":String>
Error: private method `method' called for #<PryCoolline::Wrapper:0x00000007b61f00>
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:187:in `block in read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:129:in `handle_read_errors'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:170:in `read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:98:in `read'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:68:in `block in repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `loop'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `block in start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `call'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `__with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:79:in `with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:15:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/pry_class.rb:169:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-byebug-3.3.0/lib/pry-byebug/pry_ext.rb:11:in `start_with_pry_byebug'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Error: private method `method' called for #<PryCoolline::Wrapper:0x00000007b61f00>
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:187:in `block in read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:129:in `handle_read_errors'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:170:in `read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:98:in `read'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:68:in `block in repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `loop'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `block in start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `call'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `__with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:79:in `with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:15:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/pry_class.rb:169:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-byebug-3.3.0/lib/pry-byebug/pry_ext.rb:11:in `start_with_pry_byebug'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Error: private method `method' called for #<PryCoolline::Wrapper:0x00000007b61f00>
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:187:in `block in read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:129:in `handle_read_errors'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:170:in `read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:98:in `read'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:68:in `block in repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `loop'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `block in start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `call'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `__with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:79:in `with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:15:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/pry_class.rb:169:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-byebug-3.3.0/lib/pry-byebug/pry_ext.rb:11:in `start_with_pry_byebug'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Error: private method `method' called for #<PryCoolline::Wrapper:0x00000007b61f00>
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:187:in `block in read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:129:in `handle_read_errors'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:170:in `read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:98:in `read'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:68:in `block in repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `loop'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `block in start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `call'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `__with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:79:in `with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:15:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/pry_class.rb:169:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-byebug-3.3.0/lib/pry-byebug/pry_ext.rb:11:in `start_with_pry_byebug'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
Error: private method `method' called for #<PryCoolline::Wrapper:0x00000007b61f00>
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:187:in `block in read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:129:in `handle_read_errors'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:170:in `read_line'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:98:in `read'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:68:in `block in repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `loop'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:67:in `repl'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `block in start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `call'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:61:in `__with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/input_lock.rb:79:in `with_ownership'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:38:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/repl.rb:15:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-0.10.3/lib/pry/pry_class.rb:169:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/pry-byebug-3.3.0/lib/pry-byebug/pry_ext.rb:11:in `start_with_pry_byebug'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:110:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/console.rb:9:in `start'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:68:in `console'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
/home/maximiliano/.rvm/gems/ruby-2.2.2@pow/gems/railties-4.2.5/lib/rails/commands.rb:17:in `<top (required)>'
bin/rails:4:in `require'
bin/rails:4:in `<main>'
FATAL: Pry failed to get user input using `#<struct PryCoolline::Wrapper cool=#<Coolline:0x0000000830bb70 @input=#<IO:<STDIN>>,
...
alagos commented 5 years ago

I think this is a pry issue. I don't have pry-coolline installed and I'm having issues also with the def you mentioned

andrehjr commented 2 years ago

Redefining 'method' on the top-level actually changes Kernel#method, right? So the same also breaks irb and can lead to weird behavior everywhere.

So, I'll go ahead and close this. Not sure how to fix this from pry-coolline or even pry