This is an automated email from the ASF dual-hosted git repository.

psomogyi pushed a commit to branch branch-2.4
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.4 by this push:
     new 25dc0eb  HBASE-26772 Shell suspended in background (#4137)
25dc0eb is described below

commit 25dc0eb44b8191ae1c97d76061e954e907af6887
Author: Peter Somogyi <[email protected]>
AuthorDate: Tue Mar 1 11:52:07 2022 +0100

    HBASE-26772 Shell suspended in background (#4137)
    
    Signed-off-by: Sean Busbey <[email protected]>
---
 hbase-shell/src/main/ruby/irb/hirb.rb      | 8 +++++---
 hbase-shell/src/main/ruby/jar-bootstrap.rb | 4 +++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hbase-shell/src/main/ruby/irb/hirb.rb 
b/hbase-shell/src/main/ruby/irb/hirb.rb
index 28f311c..9a81f5a 100644
--- a/hbase-shell/src/main/ruby/irb/hirb.rb
+++ b/hbase-shell/src/main/ruby/irb/hirb.rb
@@ -33,7 +33,7 @@ module IRB
       # happen is the shell exiting because of failed IRB construction with
       # no error (though we're not blanking STDERR)
 
-      # Map the '/dev/null' according to the runing platform
+      # Map the '/dev/null' according to the running platform
       # Under Windows platform the 'dev/null' is not fully compliant with unix,
       # and the 'NUL' object need to be use instead.
       devnull = '/dev/null'
@@ -42,8 +42,10 @@ module IRB
       $stdout = f
       # This is a workaround for the jruby issue 1372.
       # The stderr is an input to stty to re-adjust the terminal for the 
error('stdin isnt a terminal')
-      # incase the command is piped with hbase shell(eg - >echo 'list' | 
bin/hbase shell)
-      `stty icrnl <&2`
+      # in case the command is piped with hbase shell(eg - >echo 'list' | 
bin/hbase shell)
+      if $stdin.tty?
+        `stty icrnl <&2`
+      end
       super(workspace, input_method)
     ensure
       f.close
diff --git a/hbase-shell/src/main/ruby/jar-bootstrap.rb 
b/hbase-shell/src/main/ruby/jar-bootstrap.rb
index 6ccded5..01e014d 100644
--- a/hbase-shell/src/main/ruby/jar-bootstrap.rb
+++ b/hbase-shell/src/main/ruby/jar-bootstrap.rb
@@ -38,7 +38,9 @@
 include Java
 
 # Some goodies for hirb. Should these be left up to the user's discretion?
-require 'irb/completion'
+if $stdin.tty?
+  require 'irb/completion'
+end
 require 'pathname'
 
 # Add the directory names in hbase.jruby.sources commandline option

Reply via email to