ruby-changes:66988
From: aycabta <ko1@a...>
Date: Fri, 30 Jul 2021 02:27:03 +0900 (JST)
Subject: [ruby-changes:66988] 46c6da9c37 (master): [ruby/reline] Check empty .inputrc
https://git.ruby-lang.org/ruby.git/commit/?id=46c6da9c37 From 46c6da9c378a64deb2d65d8fcf5afd4d7c9c3f45 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Sat, 24 Jul 2021 15:01:22 +0900 Subject: [ruby/reline] Check empty .inputrc https://github.com/ruby/reline/commit/b60b3b76cd --- lib/reline/config.rb | 2 +- test/reline/test_config.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/reline/config.rb b/lib/reline/config.rb index 3e6c42d..c2b50a9 100644 --- a/lib/reline/config.rb +++ b/lib/reline/config.rb @@ -158,7 +158,7 @@ class Reline::Config https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L158 end def read_lines(lines, file = nil) - if lines.first.encoding != Reline.encoding_system_needs + if not lines.empty? and lines.first.encoding != Reline.encoding_system_needs begin lines = lines.map do |l| l.encode(Reline.encoding_system_needs) diff --git a/test/reline/test_config.rb b/test/reline/test_config.rb index b6d2ec7..aa549a3 100644 --- a/test/reline/test_config.rb +++ b/test/reline/test_config.rb @@ -311,6 +311,12 @@ class Reline::Config::Test < Reline::TestCase https://github.com/ruby/ruby/blob/trunk/test/reline/test_config.rb#L311 # do nothing end + def test_empty_inputrc + assert_nothing_raised do + @config.read_lines([]) + end + end + def test_xdg_config_home home_backup = ENV['HOME'] xdg_config_home_backup = ENV['XDG_CONFIG_HOME'] -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/