From ec9035c0c0f6a2ab3f672589091368adb101400a Mon Sep 17 00:00:00 2001 From: Caspar van Leeuwen Date: Thu, 15 Oct 2026 17:06:47 +0200 Subject: [PATCH] Interactive build: give the terminal back after the debug shell exits The debug shell has job control, so it makes its own process group the terminal's foreground group. That group was left behind as the foreground group after the shell exited, so Ctrl+C no longer reached the build (observed: TPGID pointing at an empty process group). Explicitly set our own process group as the foreground group again. Co-Authored-By: Claude Sonnet 5.5 --- EESSI-install-software.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/EESSI-install-software.sh b/EESSI-install-software.sh index 52b8968b..f621cf4c 100755 --- a/EESSI-install-software.sh +++ b/EESSI-install-software.sh @@ -110,6 +110,12 @@ debug_shell() { echo_yellow ">> Working directory: ${PWD}; exit the shell (Ctrl-D) to continue/finish" bash --rcfile "${rcfile}" -i < /dev/tty > /dev/tty 2>&1 rm -f "${rcfile}" + # The debug shell has job control, so it made its own process group the terminal's foreground group, and we don't + # get the terminal back reliably when it exits. Without this, Ctrl+C no longer reaches the build afterwards. + # (SIGTTOU is ignored, as changing the foreground group from a background group would otherwise stop us.) + python3 -c 'import os, signal +signal.signal(signal.SIGTTOU, signal.SIG_IGN) +os.tcsetpgrp(os.open("/dev/tty", os.O_RDWR), os.getpgrp())' 2>/dev/null || true } # If EESSI_INTERACTIVE_BUILD=onfail, then define a trap so that if an error is encounted that would cause the shell to exit