junegunn commented on code in PR #8629:
URL: https://github.com/apache/hbase/pull/8629#discussion_r3959268623


##########
hbase-shell/src/main/ruby/irb/hirb.rb:
##########
@@ -161,17 +163,13 @@ def eval_input
           rescue Interrupt => exc
           rescue SystemExit, SignalException
             raise
-          rescue SyntaxError => exc
-            # HBASE-27726: Ignore SyntaxError to prevent exiting Shell on 
unexpected syntax.
-            raise exc unless @interactive
-          rescue NameError => exc
-            raise exc unless @interactive
-            # HBASE-26880: Ignore NameError to prevent exiting Shell on 
mistyped commands.
           rescue Exception => exc
             # HBASE-26741: Raise exception so Shell::exception_handler can 
catch it.
             # This modifies this copied method from JRuby so that the HBase 
shell can
             # manage the exception and set a proper exit code on the process.
-            raise exc
+            # Otherwise keep the session alive and report the error, as the 
shell did before
+            # HBASE-26741. Supersedes HBASE-26880 (NameError) and HBASE-27726 
(SyntaxError).
+            raise exc if @exit_on_error

Review Comment:
   Fixed.



##########
hbase-shell/src/main/ruby/irb/hirb.rb:
##########
@@ -51,6 +51,8 @@ def initialize(workspace = nil, interactive = true, 
input_method = nil)
         `stty icrnl <&2`
       end
       @interactive = interactive
+      # Errors must abort a script run to set the exit code, but not a live 
prompt
+      @exit_on_error = !interactive || input_method.is_a?(FileInputMethod)

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to