From 0bcd88685c30c272b78974fff8b13e68fadb5742 Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Mon, 17 Nov 2025 13:19:39 +0100 Subject: [PATCH] Improve error handling during app installer run Expanded comments and adjusted error handling logic when running the application installer in the container. All error traps are disabled before lxc-attach and restored after, ensuring host error_handler does not interfere with container-level error management. --- misc/build.func | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/misc/build.func b/misc/build.func index 716e82a1a..b4e10afc3 100644 --- a/misc/build.func +++ b/misc/build.func @@ -2610,11 +2610,21 @@ MOTD_SETUP msg_ok "[DEV] MOTD/SSH ready - container accessible" fi - # Run application installer (disable ERR trap to handle errors manually) - set +e + # Run application installer + # NOTE: We disable error handling here because: + # 1. Container errors are caught by error_handler INSIDE container + # 2. Container creates flag file with exit code + # 3. We read flag file and handle cleanup manually below + # 4. We DON'T want host error_handler to fire for lxc-attach command itself + + set +Eeuo pipefail # Disable ALL error handling temporarily + trap - ERR # Remove ERR trap completely + lxc-attach -n "$CTID" -- bash -c "$(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVED/main/install/${var_install}.sh)" local lxc_exit=$? - set -e + + set -Eeuo pipefail # Re-enable error handling + trap 'error_handler' ERR # Restore ERR trap # Check for error flag file in container (more reliable than lxc-attach exit code) local install_exit_code=0