summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShugo Maeda <shugo@ruby-lang.org>2022-10-27 10:29:02 +0900
committergit <svn-admin@ruby-lang.org>2022-10-27 08:16:06 +0000
commit5129ca3e056e1ce3189ba39fa311d4d687b97b45 (patch)
treeaf21af8cfb4c60d42cc87f073d0e005ee5c99fe7
parent739ad81ff1ba28608fbc492cc0b09f96c0bd463a (diff)
[ruby/rdoc] Delay `require "readline"` in case the terminal is in raw mode
-rw-r--r--lib/rdoc/ri/driver.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/lib/rdoc/ri/driver.rb b/lib/rdoc/ri/driver.rb
index d24f8d5eff..819cff8aa3 100644
--- a/lib/rdoc/ri/driver.rb
+++ b/lib/rdoc/ri/driver.rb
@@ -1,11 +1,6 @@
# frozen_string_literal: true
require 'optparse'
-begin
- require 'readline'
-rescue LoadError
-end
-
require_relative '../../rdoc'
require_relative 'formatter' # For RubyGems backwards compatibility
@@ -1079,6 +1074,10 @@ or the PAGER environment variable.
def interactive
puts "\nEnter the method name you want to look up."
+ begin
+ require 'readline'
+ rescue LoadError
+ end
if defined? Readline then
Readline.completion_proc = method :complete
puts "You can use tab to autocomplete."