Skip to content

Commit cd5b339

Browse files
committed
HBASE-26772 Shell suspended in background (#4137)
Signed-off-by: Sean Busbey <busbey@apache.org>
1 parent 57d547d commit cd5b339

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

hbase-shell/src/main/ruby/irb/hirb.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def initialize(workspace = nil, input_method = nil)
3333
# happen is the shell exiting because of failed IRB construction with
3434
# no error (though we're not blanking STDERR)
3535

36-
# Map the '/dev/null' according to the runing platform
36+
# Map the '/dev/null' according to the running platform
3737
# Under Windows platform the 'dev/null' is not fully compliant with unix,
3838
# and the 'NUL' object need to be use instead.
3939
devnull = '/dev/null'
@@ -42,8 +42,10 @@ def initialize(workspace = nil, input_method = nil)
4242
$stdout = f
4343
# This is a workaround for the jruby issue 1372.
4444
# The stderr is an input to stty to re-adjust the terminal for the error('stdin isnt a terminal')
45-
# incase the command is piped with hbase shell(eg - >echo 'list' | bin/hbase shell)
46-
`stty icrnl <&2`
45+
# in case the command is piped with hbase shell(eg - >echo 'list' | bin/hbase shell)
46+
if $stdin.tty?
47+
`stty icrnl <&2`
48+
end
4749
super(workspace, input_method)
4850
ensure
4951
f.close

hbase-shell/src/main/ruby/jar-bootstrap.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
include Java
3939

4040
# Some goodies for hirb. Should these be left up to the user's discretion?
41-
require 'irb/completion'
41+
if $stdin.tty?
42+
require 'irb/completion'
43+
end
4244
require 'pathname'
4345
require 'getoptlong'
4446

0 commit comments

Comments
 (0)