HBASE-18393 Fix shell noninteractive launch

Signed-off-by: Sean Busbey <busbey@apache.org>
This commit is contained in:
Mike Drob 2017-07-19 12:17:02 -05:00 committed by Sean Busbey
parent 3574757f74
commit 775179bc4a
1 changed files with 9 additions and 0 deletions

View File

@ -215,6 +215,15 @@ else
require "irb/workspace" require "irb/workspace"
workspace = IRB::WorkSpace.new(binding()) workspace = IRB::WorkSpace.new(binding())
scanner = RubyLex.new scanner = RubyLex.new
# RubyLex claims to take an IO but really wants an InputMethod
module IOExtensions
def encoding
external_encoding
end
end
IO.include IOExtensions
scanner.set_input(STDIN) scanner.set_input(STDIN)
scanner.each_top_level_statement do |statement, linenum| scanner.each_top_level_statement do |statement, linenum|
puts(workspace.evaluate(nil, statement, 'stdin', linenum)) puts(workspace.evaluate(nil, statement, 'stdin', linenum))