Merge pull request #10263 from paulozulato/feat-eval-ex

feat: add new command for Elixir expression evaluation
This commit is contained in:
Paulo Zulato 2023-03-29 12:04:46 -03:00 committed by GitHub
commit 03a70bb527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 1 deletions

View File

@ -164,6 +164,9 @@ usage() {
eval-erl)
echo "Evaluate an Erlang expression in the EMQX node, even on Elixir node"
;;
eval-ex)
echo "Evaluate an Elixir expression in the EMQX node. Only applies to Elixir node"
;;
versions)
echo "List installed EMQX release versions and their status"
;;
@ -228,7 +231,7 @@ usage() {
echo " Install Info: ertspath | root_dir"
echo " Runtime Status: pid | ping"
echo " Validate Config: check_config"
echo " Advanced: console_clean | escript | rpc | rpcterms | eval | eval-erl"
echo " Advanced: console_clean | escript | rpc | rpcterms | eval | eval-erl | eval-ex"
echo ''
echo "Execute '$REL_NAME COMMAND help' for more information"
;;
@ -1280,7 +1283,27 @@ case "${COMMAND}" in
shift
relx_nodetool "eval" "$@"
;;
eval-ex)
assert_node_alive
shift
if [ "$IS_ELIXIR" = "yes" ]
then
"$REL_DIR/elixir" \
--hidden \
--name "rand-$(relx_gen_id)-$NAME" \
--cookie "$COOKIE" \
--boot "$REL_DIR/start_clean" \
--boot-var RELEASE_LIB "$ERTS_LIB_DIR" \
--vm-args "$REL_DIR/remote.vm.args" \
--erl "-start_epmd false -epmd_module ekka_epmd" \
--rpc-eval "$NAME" "$@"
else
echo "EMQX node is not an Elixir node"
usage "$COMMAND"
exit 1
fi
;;
check_config)
check_config
;;

View File

@ -0,0 +1 @@
Add command 'eval-ex' for Elixir expression evaluation.