From 52b579d26fc0685d3ebf8e3f67467152c7a914af Mon Sep 17 00:00:00 2001 From: Daniel Gibbs Date: Sun, 8 Feb 2026 23:51:25 +0000 Subject: [PATCH] Fixes mono repo install exit code check Corrects the mono repo install exit code check to use the dedicated monorepoexitcode variable, ensuring accurate error detection. Updates the exit trap to preserve the original exit status, preventing potential loss of information when handling script termination. --- lgsm/modules/check_deps.sh | 4 ++-- lgsm/modules/core_trap.sh | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lgsm/modules/check_deps.sh b/lgsm/modules/check_deps.sh index edcdb6c7b..6133fedce 100644 --- a/lgsm/modules/check_deps.sh +++ b/lgsm/modules/check_deps.sh @@ -75,11 +75,11 @@ fn_install_mono_repo() { # Run the mono repo install. eval "${cmd}" + monorepoexitcode=$? # Did Mono repo install correctly? if [ "${monoautoinstall}" != "1" ]; then - exitcode=$? - if [ "${exitcode}" -ne 0 ]; then + if [ "${monorepoexitcode}" -ne 0 ]; then fn_print_failure_nl "Unable to install Mono repository." fn_script_log_fail "Unable to install Mono repository." else diff --git a/lgsm/modules/core_trap.sh b/lgsm/modules/core_trap.sh index 4b66b3937..f9ff17ff1 100644 --- a/lgsm/modules/core_trap.sh +++ b/lgsm/modules/core_trap.sh @@ -8,10 +8,12 @@ moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")" fn_exit_trap() { + local saved_exit_status=$? + echo -e "" if [ -z "${exitcode}" ]; then - exitcode=$? + exitcode=${saved_exit_status} fi - echo -e "" + if [ -z "${exitcode}" ]; then exitcode=0 fi