mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2025-11-29 17:38:24 +08:00
fix(bash/starter): enhance interactive mode handling (#22516)
This pull request updates the startup script in `apps/startup-scripts/src/starter` to improve handling of interactive and non-interactive modes, particularly when running under different session managers. ### Improvements to interactive and non-interactive mode handling: * Updated the condition to check if the application should run interactively by combining `AC_LAUNCHED_BY_PM2` and `AC_DISABLE_INTERACTIVE` environment variables. This ensures more accurate handling of interactive mode. Fixes: https://github.com/azerothcore/azerothcore-wotlk/issues/22507
This commit is contained in:
@@ -122,12 +122,26 @@ EOF
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
echo "Starting $BINFILE without GDB"
|
echo "Starting $BINFILE without GDB"
|
||||||
if [[ "$AC_LAUNCHED_BY_PM2" == "1" ]]; then
|
# Determine if PM2 is active
|
||||||
echo "Running under PM2"
|
is_pm2_active="0"
|
||||||
|
[ "$AC_LAUNCHED_BY_PM2" == "1" ] && is_pm2_active="1"
|
||||||
|
|
||||||
|
# Determine if interactive mode is enabled
|
||||||
|
is_interactive_enabled="1"
|
||||||
|
[ "$AC_DISABLE_INTERACTIVE" == "1" ] && is_interactive_enabled="0"
|
||||||
|
|
||||||
|
# use normal execution if we are running the binary under PM2
|
||||||
|
# or when interactive mode is enabled
|
||||||
|
if [[ "$is_pm2_active" == "1" || "$is_interactive_enabled" == "1" ]]; then
|
||||||
|
echo "Running AC"
|
||||||
"$EXECPATH" ${CONFIG_ABS:+-c "$CONFIG_ABS"}
|
"$EXECPATH" ${CONFIG_ABS:+-c "$CONFIG_ABS"}
|
||||||
else
|
else
|
||||||
|
# When AC_DISABLE_INTERACTIVE is set to 1 and we are not in PM2
|
||||||
|
# This means we are using systemd without interactive mode and no session managers
|
||||||
|
# in this case we need to run AC with unbuffer for line-buffered output
|
||||||
|
# NOTE unbuffer doesn't fully support interactive mode
|
||||||
if command -v unbuffer >/dev/null 2>&1; then
|
if command -v unbuffer >/dev/null 2>&1; then
|
||||||
export AC_DISABLE_INTERACTIVE=0
|
echo "Running AC with unbuffer for line-buffered output"
|
||||||
unbuffer "$EXECPATH" ${CONFIG_ABS:+-c "$CONFIG_ABS"}
|
unbuffer "$EXECPATH" ${CONFIG_ABS:+-c "$CONFIG_ABS"}
|
||||||
else
|
else
|
||||||
echo "⚠️ unbuffer not found, the output may not be line-buffered. Try installing expect."
|
echo "⚠️ unbuffer not found, the output may not be line-buffered. Try installing expect."
|
||||||
|
|||||||
Reference in New Issue
Block a user