[ruby/rdoc] Delay `require "readline"` in case the terminal is in raw mode

This commit is contained in:
Shugo Maeda 2022-10-27 10:29:02 +09:00 committed by git
parent 739ad81ff1
commit 5129ca3e05
1 changed files with 4 additions and 5 deletions

View File

@ -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."