summaryrefslogtreecommitdiff
path: root/lib/irb/ext/save-history.rb
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2022-09-14 11:05:43 +0900
committergit <svn-admin@ruby-lang.org>2022-09-14 11:14:08 +0900
commitf863bc505cf1a976aecd0ed3cb21a3a82956953e (patch)
tree4cc88c6f9798ebe43998f12f6524ee99db8d3985 /lib/irb/ext/save-history.rb
parente2b47b832f53b2fd0626774a573a22c15a933c64 (diff)
[ruby/irb] Fix the error when LC_MESSAGES config value is nil
https://github.com/ruby/irb/commit/6bbde84369
Diffstat (limited to 'lib/irb/ext/save-history.rb')
-rw-r--r--lib/irb/ext/save-history.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/irb/ext/save-history.rb b/lib/irb/ext/save-history.rb
index ad954c3558..2135184dba 100644
--- a/lib/irb/ext/save-history.rb
+++ b/lib/irb/ext/save-history.rb
@@ -113,7 +113,7 @@ module IRB
append_history = true
end
- open(history_file, "#{append_history ? 'a' : 'w'}:#{IRB.conf[:LC_MESSAGES].encoding}", 0600) do |f|
+ File.open(history_file, (append_history ? 'a' : 'w'), 0o600, encoding: IRB.conf[:LC_MESSAGES]&.encoding) do |f|
hist = history.map{ |l| l.split("\n").join("\\\n") }
unless append_history
begin