fix: release timeout wasn't accepting command (#331)

This commit is contained in:
2025-11-02 19:39:44 +02:00
committed by GitHub
parent fd49ff6968
commit 2f1c73dd8b

View File

@@ -151,11 +151,16 @@ prompt_confirmation() {
if command -v timeout >/dev/null 2>&1; then if command -v timeout >/dev/null 2>&1; then
printf '%s [y/N] (timeout in %ss) ' "$prompt_text" "$timeout_seconds" printf '%s [y/N] (timeout in %ss) ' "$prompt_text" "$timeout_seconds"
# Use timeout command to limit read duration # Create a temporary file to store the response
# shellcheck disable=SC2016 _temp_response=$(mktemp) || return 1
if response=$(timeout "$timeout_seconds" sh -c 'read -r r </dev/tty && echo "$r"' 2>/dev/null); then
: # read succeeded within timeout # Use timeout with --foreground to allow reading from TTY
# Write response to temp file instead of trying to capture in command substitution
if timeout --foreground "$timeout_seconds" sh -c "read -r r && printf '%s' \"\$r\" > '$_temp_response'" 2>/dev/null; then
response=$(cat "$_temp_response")
rm -f "$_temp_response"
else else
rm -f "$_temp_response"
printf '\n' printf '\n'
msg_warn "Confirmation timeout - defaulting to No" msg_warn "Confirmation timeout - defaulting to No"
return 1 return 1