This project is archived and is in readonly mode.

#2104 open
Charles Oliver Nutter

script/console execs irb, causes double process-launch and limits other impls

Reported by Charles Oliver Nutter | February 28th, 2009 @ 11:53 PM | in 3.0.6

Currently script/console (via railties/lib/commands/console.rb) launches the actual IRB session using exec and by default "irb". However this causes problems for many reasons:

  • Implementations may not have IRB installed as IRB; for example, in JRuby it's "jirb", and I have Ruby 1.9 installed as irb1.9.
  • For implementations with a slower process startup time, this penalizes them. JRuby has to start the JVM twice. On platforms or JVM versions with slow startup, this causes us to be doubly slow.
  • On platforms where exec doesn't actually replace the calling process, this cases two processes to be in memory rather than just the one. This affects JRuby and running any impls on Windows.

The odd thing is that it doesn't appear that the exec is actually necessary. I'm attaching a patch that simply launches IRB from within the same process. This resolves all issues I list above. It may not be perfect but it should be a good starting point.

FWIW, the reason it works at all in JRuby is because we have long had a hack in "exec" logic that if the command being executed is "irb" we force it to run in the same JVM. But it's buggy, and we'd like to be able to get rid of that.

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>