You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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
Open another session and type up-arrow to check the above history
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
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
The text was updated successfully, but these errors were encountered:
This is the expected behavior of Kernel.exit!. Skips all at_exit handlers and ensure statements.
I think we can add exit! command that executes Kernel.exit
I'm thinking about the other direction: we patch Kernel.exit! to save history instead.
In some cases, users may want to skip at_exit hooks when they exit the session, like when debugging at_exit issues that hang the program. If we make exit! the same as exit, then there's no obvious way to leave the session without the hang (ofc, they can call Kernel.exit! manually but it's not intuitive).
Because IRB relies on
IRB.conf[:AT_EXIT]
config, which will be run inat_exit
, to save a session's input history. When users exit the session withexit!
, the input is not written.Reproduction Steps
Open an IRB session and run
Open another session and type up-arrow to check the above history
In the same session, run
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
The text was updated successfully, but these errors were encountered: