1
0
forked from Proxmox/ProxmoxVE

misc: read all interactive prompts from /dev/tty, drain leftover input on read failure

This commit is contained in:
MickLesk
2026-08-03 16:53:52 +02:00
parent 9debedc386
commit 5dacb7bdfc
6 changed files with 21 additions and 19 deletions
+2 -1
View File
@@ -499,7 +499,7 @@ error_handler() {
local response=""
local read_rc
read -t 60 -r response
read -t 60 -r response </dev/tty
read_rc=$?
if [[ $read_rc -eq 0 ]]; then
if [[ -z "$response" || "$response" =~ ^[Yy]$ ]]; then
@@ -543,6 +543,7 @@ error_handler() {
# read itself failed (e.g. broken/closed stdin, I/O error) rather than
# timing out - don't guess and destroy the container on a read we
# couldn't actually capture; keep it since that's the reversible choice.
while read -r -t 0.1 -n 1 _ </dev/tty 2>/dev/null; do :; done
echo ""
if declare -f msg_error >/dev/null 2>&1; then
msg_error "Could not read your response (stdin error) - keeping container ${CTID} for safety."