Issue #14162 has been reported by k0kubun (Takashi Kokubun).

----------------------------------------
Bug #14162: Invoking binding.irb destructively shifts ARGV
https://bugs.ruby-lang.org/issues/14162

* Author: k0kubun (Takashi Kokubun)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 2.5
* ruby -v: ruby 2.5.0dev (2017-12-05 trunk 61034) [x86_64-linux]
* Backport: 2.3: DONTNEED, 2.4: REQUIRED
----------------------------------------
~~~ ruby
$ 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.



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>