You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Samir Ahmic (JIRA)" <ji...@apache.org> on 2017/07/17 18:39:00 UTC

[jira] [Comment Edited] (HBASE-18393) hbase shell non-interactive broken

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

Samir Ahmic edited comment on HBASE-18393 at 7/17/17 6:38 PM:
--------------------------------------------------------------

[~mdrob] looks like issue is on relation RubyLex an ruby io, maybe we can fix issue by not using RubyLex and replace it with something else. For me non-interactive started working with this change:
{code}
diff --git a/bin/hirb.rb b/bin/hirb.rb
index d0295d6..94391cc 100644
--- a/bin/hirb.rb
+++ b/bin/hirb.rb
@@ -211,12 +211,9 @@ else
     #     in order to maintain compatibility with previous behavior where
     #     a user could pass in script2run and then still pipe commands on
     #     stdin.
-    require "irb/ruby-lex"
     require "irb/workspace"
     workspace = IRB::WorkSpace.new(binding())
-    scanner = RubyLex.new
-    scanner.set_input(STDIN)
-    scanner.each_top_level_statement do |statement, linenum|
+     ARGF.each_with_index do |statement, linenum|
        puts(workspace.evaluate(nil, statement, 'stdin', linenum))
     end
   # XXX We're catching Exception on purpose, because we want to include
{code}
if you think this is acceptable solution i can create patch ?


was (Author: asamir):
[~mdrob] looks like issue is on relation RubyLex an ruby io, maybe we can fix issue by not using RubyLex and replace it with something else. For me non-interactive started working with this change:
{code}
diff --git a/bin/hirb.rb b/bin/hirb.rb
index d0295d6..94391cc 100644
--- a/bin/hirb.rb
+++ b/bin/hirb.rb
@@ -211,12 +211,9 @@ else
     #     in order to maintain compatibility with previous behavior where
     #     a user could pass in script2run and then still pipe commands on
     #     stdin.
-    require "irb/ruby-lex"
     require "irb/workspace"
     workspace = IRB::WorkSpace.new(binding())
-    scanner = RubyLex.new
-    scanner.set_input(STDIN)
-    scanner.each_top_level_statement do |statement, linenum|
+     ARGF.each_with_index do |statement, linenum|
        puts(workspace.evaluate(nil, statement, 'stdin', linenum))
     end
   # XXX We're catching Exception on purpose, because we want to include
{code}
if you think this is acceptable solution a can create patch ?

> 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)