summaryrefslogtreecommitdiff
path: root/lib/reline
diff options
context:
space:
mode:
authoraycabta <aycabta@gmail.com>2020-03-21 18:13:50 +0900
committeraycabta <aycabta@gmail.com>2020-03-26 17:41:21 +0900
commit90913bfabe427993e82d4a72616739ee49e61a5d (patch)
treec01354f28fbad70d502dc22d97a9981df248cff1 /lib/reline
parentf245fb1ab8d893a89c8749a703efea0b16353028 (diff)
[ruby/reline] Suppress error in case INPUTRC env is empty
https://github.com/ruby/reline/commit/bce7e7562b
Diffstat (limited to 'lib/reline')
-rw-r--r--lib/reline/config.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/reline/config.rb b/lib/reline/config.rb
index 61708f96a7..53b868fd2e 100644
--- a/lib/reline/config.rb
+++ b/lib/reline/config.rb
@@ -83,8 +83,17 @@ class Reline::Config
@key_actors[@keymap_label]
end
+ def inputrc_path
+ case ENV['INPUTRC']
+ when nil, ''
+ DEFAULT_PATH
+ else
+ ENV['INPUTRC']
+ end
+ end
+
def read(file = nil)
- file ||= File.expand_path(ENV['INPUTRC'] || DEFAULT_PATH)
+ file ||= File.expand_path(inputrc_path)
begin
if file.respond_to?(:readlines)
lines = file.readlines