bellycard/napa — pull request #108 by voxtex (2014-06-29 17:03:01+00:00)
Title: Fix napa console when using IRB.

IRB was taking extra arguments, "console" and optionally the environment, when running `napa console `. IRB then interprets this as a script name and errors out. These arguments are now removed from ARGV before starting the interpreter.

Here's the exact flow of things that happen to break IRB:

1) @CONF[:SCRIPT] gets set to 'console' since it is the first argument.
https://github.com/ruby/ruby/blob/1aa54bebaf274bc08e72f9ad3854c7ad592c344a/lib/irb/init.rb#L218

2) Irb is initialized with @CONF[:SCRIPT] which is passed in as `input_method`.
https://github.com/ruby/ruby/blob/77a8010abddbbcf06bc2b5d423e0284b4e4ea4c8/lib/irb.rb#L383

3) Context interprets this as a file name and tries to read it.
https://github.com/ruby/ruby/blob/77a8010abddbbcf06bc2b5d423e0284b4e4ea4c8/lib/irb/context.rb#L85

Everything bombs. My fix is to just remove the arguments that are being passed into napa console, leaving the ability to still pass arguments to IRB if desired.