HBASE-26469 correct HBase shell exit behavior to match code passed to exit (#4018)
commit821e6a36cc88c2348cda6af8d9eb8a526054dffc
authorSean Busbey <busbey@apache.org>
Wed, 29 Sep 2021 04:00:11 +0000 (28 23:00 -0500)
committerSean Busbey <busbey@apache.org>
Fri, 14 Jan 2022 22:31:37 +0000 (14 16:31 -0600)
tree17b9887f2ffa699cadab8c088f62ae1567a201cf
parent3a14cfc6f928755ac581ade8184b93fd440b3b14
HBASE-26469 correct HBase shell exit behavior to match code passed to exit (#4018)

* refactors how we handle running the passed in initialization script to make use of IRB sessions
  directly instead of reimplementing things ourselves
* simplify how we initialize our IRB config
* insert a shim for capturing exit codes passed via user calls to exit
* make use of user provided exit code unless we're reading stdin in interactive mode

This changes the exit code of the shell
* a 0 return code, or no return code, passed to a call to exit from stdin in non-interactive mode
  will now exit cleanly. in prior versions this would have exitted with an error and non-zero exit
  code.
* for other combinations of passing in an initilization script or reading from stdin with using the
  non-interactive flag, the exit code being 0 or non-0 should now line up with releases prior to
  2.4.z, which is a change in behavior compared to 2.4.z.

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
hbase-shell/src/main/ruby/irb/hirb.rb
hbase-shell/src/main/ruby/jar-bootstrap.rb
hbase-shell/src/main/ruby/shell.rb
hbase-shell/src/main/ruby/shell/hbase_loader.rb [deleted file]
hbase-shell/src/test/ruby/shell/shell_test.rb