开发者

Why do things sometimes go missing from my irb history?

开发者 https://www.devze.com 2023-03-11 07:27 出处:网络
Sometimes things are missing from my irb history. This has been happening for years and I haven\'t really noticed a 开发者_JAVA百科pattern. I\'ll use irb for a while, control-d out of it, come back in

Sometimes things are missing from my irb history. This has been happening for years and I haven't really noticed a 开发者_JAVA百科pattern. I'll use irb for a while, control-d out of it, come back in a few minutes later, and the commands I was just using aren't there, but commands from earlier in the day or week are there. This is mostly/always in a rails console.

Here's my .irbrc


I could be wrong, but reading over http://trac.greenstone.org/browser/extensions/gsdl-video/trunk/installed/cmdline/lib/ruby/1.8/irb/ext/save-history.rb?rev=18425 makes me think that the last irb process will overwrite the other processes history with its own.

So if you run:

irb 
irb  #in another term window

"a string" #then Ctrl-D in the first

#Ctrl-D in the second

then your .irb-history should be unchanged, as the initial, backgrounded irb will have loaded the old history, then overwritten the new history as it exits.

ie: Somewhat foolishly: open('w') rather than open('a') is the culprit.

You might consider writing a patch and commiting it for the greater good if this strongly irritates you.

0

精彩评论

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

关注公众号