Extract reclaim_tty into reusable function

Move the inline TTY reclamation logic from build.func into a standalone reclaim_tty() function in core.func. This improves code reusability, as the function now needs to be called before each interactive prompt (not just after install) since pct exec/pull/enter can take the terminal away again. The function also includes better error handling with checks for perl availability and /dev/tty existence, and explicitly sets SIGTTOU to IGNORE in perl.
This commit is contained in:
MickLesk
2026-08-05 14:57:15 +02:00
parent 58d819b2f4
commit 078a76f263
3 changed files with 42 additions and 9 deletions
+1
View File
@@ -499,6 +499,7 @@ error_handler() {
local response=""
local read_rc
declare -f reclaim_tty >/dev/null 2>&1 && reclaim_tty
read -t 60 -r response </dev/tty
read_rc=$?
if [[ $read_rc -eq 0 ]]; then