Merge pull request #13489 from thalesmg/20240718-m-init-debug

feat(bin/emqx): add `-init_debug` system arg when `DEBUG=2`
This commit is contained in:
Thales Macedo Garitezi 2024-07-24 09:16:12 -03:00 committed by GitHub
commit 311419f621
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 16 additions and 2 deletions

View File

@ -341,7 +341,7 @@ COMPATIBILITY_CHECK='
end, end,
halt(0). halt(0).
' '
[ "$DEBUG" -eq 1 ] && set -x [[ "$DEBUG" -gt 0 ]] && set -x
compatiblity_info() { compatiblity_info() {
# RELEASE_LIB is used by Elixir # RELEASE_LIB is used by Elixir
@ -569,7 +569,7 @@ else
fi fi
fi fi
logdebug "EMQX_BOOT_CONFIGS: $EMQX_BOOT_CONFIGS" logdebug "EMQX_BOOT_CONFIGS: $EMQX_BOOT_CONFIGS"
[ "$DEBUG" -eq 1 ] && set -x [[ "$DEBUG" -gt 0 ]] && set -x
get_boot_config() { get_boot_config() {
path_to_value="$1" path_to_value="$1"
@ -1250,6 +1250,12 @@ case "${COMMAND}" in
# Build an array of arguments to pass to exec later on # Build an array of arguments to pass to exec later on
# Build it here because this command will be used for logging. # Build it here because this command will be used for logging.
if [ "$IS_ELIXIR" = no ] || [ "${EMQX_CONSOLE_FLAVOR:-}" = 'erl' ] ; then if [ "$IS_ELIXIR" = no ] || [ "${EMQX_CONSOLE_FLAVOR:-}" = 'erl' ] ; then
if [[ "$DEBUG" == 2 ]]; then
INIT_DEBUG_ARG="-init_debug"
else
INIT_DEBUG_ARG=""
fi
# pass down RELEASE_LIB so we can switch to IS_ELIXIR=no # pass down RELEASE_LIB so we can switch to IS_ELIXIR=no
# to boot an Erlang node from the elixir release # to boot an Erlang node from the elixir release
set -- "$BINDIR/erlexec" \ set -- "$BINDIR/erlexec" \
@ -1260,8 +1266,15 @@ case "${COMMAND}" in
-mode "$CODE_LOADING_MODE" \ -mode "$CODE_LOADING_MODE" \
-config "$CONF_FILE" \ -config "$CONF_FILE" \
-args_file "$ARGS_FILE" \ -args_file "$ARGS_FILE" \
$INIT_DEBUG_ARG \
$EPMD_ARGS $EPMD_ARGS
else else
if [[ "$DEBUG" == 2 ]]; then
INIT_DEBUG_ARG="--erl -init_debug"
else
INIT_DEBUG_ARG=""
fi
set -- "$REL_DIR/iex" \ set -- "$REL_DIR/iex" \
--boot "$BOOTFILE" \ --boot "$BOOTFILE" \
--boot-var RELEASE_LIB "${ERTS_LIB_DIR}" \ --boot-var RELEASE_LIB "${ERTS_LIB_DIR}" \
@ -1270,6 +1283,7 @@ case "${COMMAND}" in
--erl "$FOREGROUNDOPTIONS" \ --erl "$FOREGROUNDOPTIONS" \
--erl "-mode $CODE_LOADING_MODE" \ --erl "-mode $CODE_LOADING_MODE" \
--erl "$EPMD_ARGS" \ --erl "$EPMD_ARGS" \
$INIT_DEBUG_ARG \
--werl --werl
fi fi