Skip to content

IRB doesn't save input history when exited with exit! #612

@st0012

Description

@st0012

Because IRB relies on IRB.conf[:AT_EXIT] config, which will be run in at_exit, to save a session's input history. When users exit the session with exit!, the input is not written.

Reproduction Steps

  1. Open an IRB session and run

    irb(main):001:0> a = 1
    => 1
    irb(main):002:0> b = 2
    => 2
    irb(main):003:0> exit
    
  2. Open another session and type up-arrow to check the above history

  3. In the same session, run

    irb(main):001:0> c = 3
    => 3
    irb(main):002:0> d = 4
    => 4
    irb(main):003:0> exit! # with a ! this time
    
  4. Open another session and type up-arrow to view history

Expected Behaviour

Input from step 3 should be part of the history

Actual Behaviour

Input from step 3 is lost

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions