[ 
https://issues.apache.org/jira/browse/HBASE-18393?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16090311#comment-16090311
 ] 

Mike Drob commented on HBASE-18393:
-----------------------------------

I _think_ that RubyLex will handle line continuations while ARGF won't. This 
would be a good thing to check.

Otherwise, we can reopen IO and add the missing encoding method:

{code}
diff --git a/bin/hirb.rb b/bin/hirb.rb
index d0295d638d..9d8e3750e1 100644
--- a/bin/hirb.rb
+++ b/bin/hirb.rb
@@ -215,7 +215,15 @@ else
     require "irb/workspace"
     workspace = IRB::WorkSpace.new(binding())
     scanner = RubyLex.new
-    scanner.set_input(STDIN)
+
+    # RubyLex calls STDIN an IO but actually expects InputMethod
+    module IOExtensions
+      def encoding
+        external_encoding
+      end
+    end
+    IO.include IOExtensions
+
     scanner.each_top_level_statement do |statement, linenum|
        puts(workspace.evaluate(nil, statement, 'stdin', linenum))
     end
{code}

> hbase shell non-interactive broken  
> ------------------------------------
>
>                 Key: HBASE-18393
>                 URL: https://issues.apache.org/jira/browse/HBASE-18393
>             Project: HBase
>          Issue Type: Bug
>          Components: scripts, shell
>    Affects Versions: 3.0.0, 2.0.0-alpha-1
>            Reporter: Samir Ahmic
>            Assignee: Samir Ahmic
>            Priority: Blocker
>             Fix For: 2.0.0-beta-1
>
>
> Here is error for command line:
> {code}
> $ echo "list" | ./hbase shell -n
> 2017-07-17 08:01:09,442 WARN  [main] util.NativeCodeLoader: Unable to load 
> native-hadoop library for your platform... using builtin-java classes where 
> applicable
> ERROR NoMethodError: undefined method `encoding' for #<IO:<STDIN>>
> Did you mean?  set_encoding
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to