debug icon indicating copy to clipboard operation
debug copied to clipboard

Running irb on debugger on irb dose not save the irb history

Open takatea opened this issue 3 years ago • 1 comments

Your environment

  • ruby -v: ruby 3.3.0preview1
  • rdbg -v: 1.8.0
  • Execute irb_info on irb
    irb(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

  1. Prepare a Ruby script ~/path_to_test_rb/test.rb like this:

    require "debug"
    
    class Test
        def run
            debugger
        end
    end
    
  2. Remove ~/.irb_history and ~/.rdbg_history files to clean up

  3. Run irb (irb#1)

  4. Require ~/path_to_test_rb/test.rb on irb

  5. Execute Test.new.run on irb

  6. Debugger start

  7. Execute the irb command on debug

  8. Start the second irb (irb#2)

  9. Quit irb#2

  10. Execute the continue command on debug

  11. Quit irb#1

  12. 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

takatea avatar Aug 03 '23 14:08 takatea

This issue will be closed as the original report ruby/irb#666 has been resolved.

IRB team, thank you for fixing this problem!

takatea avatar Aug 09 '23 16:08 takatea