Running irb on debugger on irb dose not save the irb history
Your environment
ruby -v: ruby 3.3.0preview1rdbg -v: 1.8.0- Execute
irb_infoon irbirb(main):001:0> irb_info Ruby version: 3.3.0 IRB version: irb 1.7.4 (2023-07-15) InputMethod: RelineInputMethod with Reline 0.3.6 RUBY_PLATFORM: x86_64-darwin22 LANG env: ja_JP.UTF-8 East Asian Ambiguous Width: 1
Describe the bug
Running irb on debugger on irb dose not save the irb history.
To Reproduce
-
Prepare a Ruby script
~/path_to_test_rb/test.rblike this:require "debug" class Test def run debugger end end -
Remove
~/.irb_historyand~/.rdbg_historyfiles to clean up -
Run irb (
irb#1) -
Require
~/path_to_test_rb/test.rbon irb -
Execute
Test.new.runon irb -
Debugger start
-
Execute the irb command on debug
-
Start the second irb (
irb#2) -
Quit
irb#2 -
Execute the continue command on debug
-
Quit
irb#1 -
Execute
ls ~/.irb_history ~/.rdbg_history
For example, my case is:
$ irb
irb(main):001:0> require "./test"
=> true
irb(main):002:0> Test.new.run
[1, 7] in ~/path_to_test_rb/test.rb
1| require "debug"
2|
3| class Test
4| def run
=> 5| debugger
6| end
7| end
=>#0 Test#run at ~/path_to_test_rb/test.rb:5
#1 <top (required)> at (irb):2
# and 18 frames (use `bt' command for all frames)
(ruby) puts :debugger
debugger
nil
(rdbg) irb # command
irb(#<Test:0x000000010d472dc8>):001:0> puts :irb
irb
=> nil
irb(#<Test:0x000000010d472dc8>):002:0> quit
(rdbg) continue # continue command
=> #<Test:0x000000010d472dc8>
$ ls ~/.irb_history ~/.rdbg_history
Actual Result
$ ls ~/.irb_history ~/.rdbg_history
ls: /Users/username/.irb_history: No such file or directory
/Users/username/.rdbg_history
Expected behavior
$ ls ~/.irb_history ~/.rdbg_history
/Users/username/.irb_history
/Users/username/.rdbg_history
Additional Note
I have also reported this problem on ruby/irb#666
This issue will be closed as the original report ruby/irb#666 has been resolved.
IRB team, thank you for fixing this problem!