Skip to content
This repository

pry dislikes ruby compiled without readline (much so) #556

Closed
danielb2 opened this Issue April 30, 2012 · 9 comments

5 participants

Daniel Bretoi Conrad Irwin John Mair Kyrylo Silin Robert A. Heiler
Daniel Bretoi

If pry is run without readline compiled in ruby, the error below is displayed.

Pry should probably automatically disable readline if it's not available. See related ticket at: #473

$ pry
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:11: warning: already initialized constant DEFAULT_HOOKS
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:23: warning: already initialized constant DEFAULT_PRINT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:48: warning: already initialized constant SIMPLE_PRINT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:57: warning: already initialized constant CLIPPED_PRINT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:62: warning: already initialized constant DEFAULT_EXCEPTION_HANDLER
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:68: warning: already initialized constant DEFAULT_EXCEPTION_WHITELIST
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:71: warning: already initialized constant DEFAULT_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:82: warning: already initialized constant SIMPLE_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:84: warning: already initialized constant SHELL_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:91: warning: already initialized constant NAV_PROMPT
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:107: warning: already initialized constant DEFAULT_CONTROL_D_HANDLER
/home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:121: warning: already initialized constant DEFAULT_SYSTEM
/home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- readline (LoadError)
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/lib/pry.rb:171:in `<top (required)>'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/vagrant/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/bin/pry:12:in `rescue in <top (required)>'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.9.4/bin/pry:8:in `<top (required)>'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/bin/pry:23:in `load'
        from /home/vagrant/.rvm/gems/ruby-1.9.3-p194/bin/pry:23:in `<main>'
John Mair
Owner

Can you tell me how IRB behaves in absense of readline? maybe a gist or screenshot (im curious about whether they have a prompt and whether history works)

Daniel Bretoi

You get the big failure I pasted above.

John Mair
Owner

@danielb2 so IRB fails too, as well as pry?

Daniel Bretoi

oh I'm sorry. I completely glossed over the fact that you wrote IRB. Hm, I don't know. That install now has readline.
let me try to see what I can find.

Kyrylo Silin
Collaborator
kyrylo commented May 01, 2012

Ruby 1.9.3 and Pry 0.9.9.4 here.

My arrow keys stopped working properly in pry and irb (navigation through history). However, they worked flawlessly before. I just dormantly updated my system (Arch Linux) so I don't really know, what it could be. Shell history works as always: perfect. Here is the video of the problem (I hope it's understandable):

http://youtu.be/zuGCHqmeO98

I also tested out 0.9.9.4 on Xubuntu and got exactly the same result as @danielb2

Robert A. Heiler

IRB without readline works fine. You can use irb with or without readline.

Difference is that you won't get some cool features in IRB without readline though, like using arrow key to scrollback (which can be very useful if you want to easily edit a long command you just wrote which had a typo).

I think Debian may sometimes have an IRB without readline.

It's interesting that danielb2 uses RVM without a readline available, but yeah, pry should make readline optional :)

Kyrylo Silin
Collaborator
kyrylo commented May 01, 2012

False alarm, guys. I merely added this to my .inputrc:

set editing-mode vi

Thanks to @ConradIrwin, who helped me to understand the problem.

Daniel Bretoi
$ irb
Readline was unable to be required, if you need completion or history install readline then reinstall the ruby.
You may follow 'rvm notes' for dependencies and/or read the docs page https://rvm.io/packages/readline/ . Be sure you 'rvm remove X ; rvm install X' to re-compile your ruby with readline support after obtaining the readline libraries.
Conrad Irwin ConradIrwin closed this in c80c203 June 04, 2012
Conrad Irwin
Owner

I've left #473 open in case we want to actually support non-readline rubies. I don't think we do in the near term, but there may be good reasons (if some popular hosting provider compiles ruby with no readline support for example).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.