From aa6b7b0701a683c7457bdd9ff3e5732be19a8f59 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 20 Jan 2015 04:09:24 +0000 Subject: [PATCH] redmine-backporter.rb: try Readline * tool/redmine-backporter.rb (readline): try Readline.readline if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49350 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- tool/redmine-backporter.rb | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tool/redmine-backporter.rb b/tool/redmine-backporter.rb index 46346b3fd7..5ebc4dffdf 100755 --- a/tool/redmine-backporter.rb +++ b/tool/redmine-backporter.rb @@ -8,6 +8,12 @@ require 'stringio' require 'strscan' require 'optparse' require 'pp' +begin + require 'readline' +rescue LoadError +else + include Readline +end VERSION = '0.0.1' @@ -195,7 +201,7 @@ def more(sio) end end -def readline(prompt = '') +def Readline.readline(prompt = '') console = IO.console console.binmode ly, lx = console.winsize @@ -226,7 +232,7 @@ def readline(prompt = '') line << c end end -end +end unless defined?(Readline.readline) def mergeinfo `svn propget svn:mergeinfo #{RUBY_REPO_PATH}` @@ -266,7 +272,7 @@ puts "Backporter #{VERSION}".color(bold: true) + " for #{TARGET_VERSION}" @changesets = nil while true begin - l = readline '> ' + l = Readline.readline '> ' rescue Interrupt break end