开发者

History not saving

开发者 https://www.devze.com 2022-12-11 13:38 出处:网络
Why is my irb history no longer saving?开发者_如何转开发It turns out that ruby 1.8.7 introduced a bug whereby finalizers are no longer guaranteed to run.

Why is my irb history no longer 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


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"
0

精彩评论

暂无评论...
验证码 换一张
取 消