Invoking binding.irb destructively shifts ARGV
$ ruby -v ruby 2.5.0dev (2017-12-05 trunk 61034) [x86_64-linux] $ cat script.rb binding.irb binding.irb $ ruby script.rb a b c From: script.rb @ line 1 : => 1: binding.irb 2: binding.irb irb(main):001:0> p ARGV ["b", "c"] => ["b", "c"] irb(main):002:0> From: script.rb @ line 2 : 1: binding.irb => 2: binding.irb irb(main):001:0> p ARGV ["c"] => ["c"]
Is this intentional? This is reproductive on both Ruby 2.4 and 2.5.
Updated by k0kubun (Takashi Kokubun) almost 5 years ago
- Status changed from Open to Closed
Applied in changeset trunk|r61149.
irb.rb: preserve ARGV on binding.irb
This is not perfectly good solution (at least we don't want to have ARGV
as default value of
argv argument), but unfortunately IRB.setup and
IRB.parse_opts are public methods and we can't make breaking change to
We may deprecate using them and then make them private in the future,
but the removal should not be in Ruby 2.5. So I kept their interface for
[Bug #14162] [close GH-1770]