irb keeps saving history, even though turned off via IRB configuration

290 Views Asked by At

I have in my .irbrc the statements

IRB.conf[:SAVE_HISTORY] = nil
IRB.conf[:EVAL_HISTORY] = nil

but irb still creates a history file. Do I need to set something else?

UPDATE: On request, this is the effective command used to run irb (pathes shortened):

export IRBRC=/path/to/irbrc_for_testing.rb
java -Xmx4G -cp /path/to/org/jruby/jruby-complete/1.7.27/jruby-complete-1.7.27.jar org.jruby.Main /path/to/bin/jirb_swing_ex

The files jruby-complete-1.7.27.jar and jirb_swing_ex were downloaded from the JRuby web site.

The file irbrc_for_testing.rb contains the IRB.conf settings.

3

There are 3 best solutions below

0
user1934428 On BEST ANSWER

I found a solution:

My irb setup file (i.e. the one which configures IRB.conf) performs at the end the command load(user_irbrc), where the variable user_irbrc (by some unfortunate circumstances) pointed to a certain irbrc setup file put in place by the rbenv version manager (which I used some times ago for switching between MRI rubies). It seems that this rbenv irbrc was responsible for putting back IRB.conf[:SAVE_HISTORY] to the value of 100.

After I fixed that undesired load command, history saving is turned off.

1
kun On

By default, irb will store the last 1000 commands you used in IRB.conf[:HISTORY_FILE] (~/.irb_history by default).

If you want to disable the history feature, add IRB.conf[:SAVE_HISTORY] = nil to your .irbrc file and run the irb command in the same directory where your .irbrc file is located.

5
Max On

You can see in the jruby source code for your release that those config values are used even in that version of irb. The issue must simply be in how it is trying to load your config file.

You can see lower down in that same file that irb also looks for an environment variable to locate the config. Try running it like this

IRBRC=/path/to/your/irbrc irb