Why is my irb history no longer saving?
History not saving
It turns out that ruby 1.8.7 introduced a bug whereby finalizers are no longer guaranteed to run.
To resolve this, I added the following code snippet to my .irbrc file:
require 'irb/ext/save-history'
Kernel.at_exit do
IRB::HistorySavingAbility.create_finalizer.call(IRB.CurrentContext.instance_variable_get(:@io).send(:binding))
end
Does not work for me. $ irb -v irb 0.9.5(05/04/13) $ ruby -v ruby 1.8.7 (2010-12-23 patchlevel 330) [i686-darwin10] –
Isabellaisabelle
Thanks a lot! In another answer there were a link to a patch, but that wasn't available any longer. Yes, I have a customer that is still using Ruby 1.8 –
Salvo
I ran into this with ruby 2.3.7 as well. It was caused by rvm ruby package not having the correct permissions to update the default .irbrc_history file. This appears to be a known bug.
An easy work around is to just change the location of this history file in your ~/.irbrc
file.
IRB.conf[:HISTORY_FILE] = "#{ENV['HOME']}/.irb_history"
© 2022 - 2024 — McMap. All rights reserved.