From b09f2db2a96947dcb9e8fb2dd8b98326dce79c43 Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Wed, 25 Feb 2026 14:45:11 +0100 Subject: [PATCH] Handle job-control signals and clear tostop Prevent terminal job-control signals from suspending the script during recovery by trapping TSTP, TTIN and TTOU (instead of only TSTP) and restoring them on exit. Also clear the terminal 'tostop' flag in stop_spinner() with `stty -tostop` to avoid background spinner I/O from stopping the process group. --- misc/build.func | 9 +++++---- misc/core.func | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/misc/build.func b/misc/build.func index 2b4b41f26..b1ce4fdf3 100644 --- a/misc/build.func +++ b/misc/build.func @@ -4098,10 +4098,11 @@ EOF' # Installation failed? if [[ $install_exit_code -ne 0 ]]; then - # Prevent SIGTSTP (Ctrl+Z) from suspending the script during recovery. + # Prevent job-control signals from suspending the script during recovery. # In non-interactive shells (bash -c), background processes (spinner) can # trigger terminal-related signals that stop the entire process group. - trap '' TSTP + # TSTP = Ctrl+Z, TTIN = bg read from tty, TTOU = bg write to tty (tostop) + trap '' TSTP TTIN TTOU msg_error "Installation failed in container ${CTID} (exit code: ${install_exit_code})" @@ -4551,8 +4552,8 @@ EOF' post_update_to_api "failed" "$install_exit_code" "force" $STD echo -e "${TAB}${CM:-✔} Telemetry finalized" - # Restore default SIGTSTP handling before exit - trap - TSTP + # Restore default job-control signal handling before exit + trap - TSTP TTIN TTOU exit $install_exit_code fi diff --git a/misc/core.func b/misc/core.func index 0d203a77b..c77324edc 100644 --- a/misc/core.func +++ b/misc/core.func @@ -607,6 +607,7 @@ stop_spinner() { unset SPINNER_PID SPINNER_MSG stty sane 2>/dev/null || true + stty -tostop 2>/dev/null || true } # ==============================================================================