Search code examples
rubybundler

How do I get `bundle console` to not die to Ctrl + C


I'm going development on a ruby gem. When I run bundle console it launches a ruby console that works like normal in all regards except that [Ctrl] + [C] kills the console. In pry or irb, [Ctrl] + [C] just abandons the current input line and gives me a new one. How can I get this behavior (killing the just entered line rather than the entire terminal session) through bundle console?

Update: this only happens with pry (which I have as a development dependency: spec.add_development_dependency "pry", "~> 0.12.0"). When I comment out pry from the development dependencies and the console falls back to irb, [Ctrl] + [C] has the normal behavior of aborting the current input. As I mentioned, running pry outside the context of bundle console also has the normal [Ctrl] + [C] behavior of aborting the current input; this problem only happens when running pry through bundle console.


Solution

  • Using bundle exec pry instead of bundle console fixes this.