apurtell commented on code in PR #8703:
URL: https://github.com/apache/hbase/pull/8703#discussion_r4107386473


##########
bin/hbase:
##########
@@ -795,6 +851,40 @@ elif [ "$COMMAND" = "credential" ] ; then
   CLASS='org.apache.hadoop.security.alias.CredentialShell'
 elif [ "$COMMAND" = "copyreppeers" ] ; then
   CLASS='org.apache.hadoop.hbase.replication.CopyReplicationPeers'
+elif [[ "$COMMAND" == *.jsh ]] ; then
+  # No JDK version guard here: hbase-config.sh already requires JDK 17+.
+  resolve_bin_script "$COMMAND" "jshell script"
+  JSH_SCRIPT="$RESOLVED_BIN_SCRIPT"
+  # pass positional args to the script via env vars: jshell script mode has no
+  # String[] args equivalent, and re-joining/re-splitting args into one string
+  # breaks on embedded spaces, so each arg gets its own env var instead.
+  # See HBASE_JSH_ARG_N / HBASE_JSH_ARG_COUNT in the header and 
hbase_startup.jsh.
+  i=0
+  for a in "$@"; do
+    export HBASE_JSH_ARG_$i="$a"
+    i=$((i+1))
+  done
+  export HBASE_JSH_ARG_COUNT=$i
+  set --
+  CLASS='jdk.internal.jshell.tool.JShellToolProvider'
+  init_jshell_args
+  JSHELL_ARGS+=(-q "$JSH_SCRIPT")

Review Comment:
   This unconditionally appends `-q` regardless of what's in 
`HBASE_JSHELL_ARGS`. This will make `bin/hbase myscript.jsh` fail immediately 
with exit 1 in many cases (e.g. any `--feedback <mode>` other than literally 
`-q`)



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