text 18 Nov irb/console not saving in ruby 1.8.7

In case you don’t read Japanese.

Index: lib/irb/ext/save-history.rb
===================================================================
--- lib/irb/ext/save-history.rb (revision 23644)
+++ lib/irb/ext/save-history.rb (working copy)
@@ -51,7 +51,7 @@
     include Readline

     def HistorySavingAbility.create_finalizer
-      proc do
+      at_exit do
  if num = IRB.conf[:SAVE_HISTORY] and (num = num.to_i) > 0
    if hf = IRB.conf[:HISTORY_FILE]
      file = File.expand_path(hf)
@@ -66,7 +66,7 @@
     end

     def HistorySavingAbility.extended(obj)
-      ObjectSpace.define_finalizer(obj, HistorySavingAbility.create_finalizer)
+      HistorySavingAbility.create_finalizer
       obj.load_history
       obj
     end

via http://redmine.ruby-lang.org/issues/show/1556

blog comments powered by Disqus

Design inspired by Prashanth Kamalakanthan. Content powered by Tumblr.