From 50a7f44ff3ca7f5a04c831a85758661d444f9cd6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Sat, 7 Mar 2026 09:24:10 +0000 Subject: [PATCH] Address code review: capture exit code explicitly in fallback error message Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com> --- .templates/ha_entrypoint.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.templates/ha_entrypoint.sh b/.templates/ha_entrypoint.sh index f013e26f4..8370520e1 100755 --- a/.templates/ha_entrypoint.sh +++ b/.templates/ha_entrypoint.sh @@ -217,12 +217,16 @@ run_one_script() { "$script" || _run_rc=$? if [ "$_run_rc" -eq 126 ] && [ -n "${BASHIO_LIB:-}" ]; then echo "Direct exec failed (rc=126, likely E2BIG), retrying via source in subshell..." + _run_rc=0 ( # shellcheck disable=SC1090 . "$BASHIO_LIB" 2>/dev/null || true # shellcheck disable=SC1090 . "$script" - ) || echo -e "\033[0;31mError\033[0m : $script exiting $?" + ) || _run_rc=$? + if [ "$_run_rc" -ne 0 ]; then + echo -e "\033[0;31mError\033[0m : $script exiting $_run_rc" + fi elif [ "$_run_rc" -ne 0 ]; then echo -e "\033[0;31mError\033[0m : $script exiting $_run_rc" fi