Running rails console with bundle exec

2019-03-31 05:32发布

问题:

When I execute bundle exec rails c I get a ruby console with the following prompt

Loading development environment (Rails 3.0.3)
jruby-1.6.3 :001 >

Everything looks in order but when I use the ↑ ↓ arrows to pull my previous command I get ^[[A^[[B output into my console.

Running rails console without bundle exec works fine. Any reason as to why this is? Is bundle exec starting up some new faux shell?

回答1:

It looks like bundler prevents the irb console from using readline. You can work around this by putting the following line in your .irbrc, which will force irb to use readline:

IRB.conf[:USE_READLINE] = true