1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* lib/irb/ext/save-history.rb: outputs its history to

owner-only-readable file and change the permission of a file that
	  already exists [Bug #7694]. Thanks Nobuhiro IMAI for bug reports.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38813 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
keiju 2013-01-14 14:17:18 +00:00
parent 7dd52f895f
commit 9deb82b1d9
2 changed files with 18 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Mon Jan 14 23:06:41 2013 Keiju Ishitsuka <keiju@ishitsuka.com>
* lib/irb/ext/save-history.rb: outputs its history to
owner-only-readable file and change the permission of a file that
already exists [Bug #7694]. Thanks Nobuhiro IMAI for bug reports.
Mon Jan 14 17:12:48 2013 Shugo Maeda <shugo@ruby-lang.org>
* enumerator.c (lazy_flat_map_func): flat_map should call each only

View file

@ -92,7 +92,18 @@ module IRB
history_file = File.expand_path(history_file)
end
history_file = IRB.rc_file("_history") unless history_file
open(history_file, 'w' ) do |f|
# Change the permission of a file that already exists[BUG #7694]
begin
if File.stat(history_file).mode & 066
File.chmod(0600, history_file)
end
rescue Errno::ENOENT
rescue
raise
end
open(history_file, 'w', 0600 ) do |f|
hist = HISTORY.to_a
f.puts(hist[-num..-1] || hist)
end