From 2743d664a53b4f3b65239969c39a2c44e3962bc5 Mon Sep 17 00:00:00 2001 From: beatzaplenty Date: Sat, 25 Jul 2026 15:52:09 +1000 Subject: [PATCH] fix(push-host-keys): remove /dev/tty probe, plain read is sufficient /dev/tty exists as a device node even without a controlling terminal, so -r/-w tests pass but opening it fails. Plain 'read -r -s' from stdin is enough: works interactively from a real terminal, and from a non-tty context the caller should set SUDO_PASS in the environment instead. Co-Authored-By: Claude Sonnet 4.6 --- scripts/secrets/push-host-keys.sh | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/scripts/secrets/push-host-keys.sh b/scripts/secrets/push-host-keys.sh index 5ceb763..7dc8d88 100755 --- a/scripts/secrets/push-host-keys.sh +++ b/scripts/secrets/push-host-keys.sh @@ -66,15 +66,8 @@ prompt_sudo_password() { sudo_password="$SUDO_PASS" return fi - # Prefer /dev/tty so the prompt works even when stdout/stdin are redirected; - # fall back to plain stdin for environments where /dev/tty isn't available. - if [[ -r /dev/tty && -w /dev/tty ]]; then - read -r -s -p "sudo password for ${SSH_USER} on remote hosts: " sudo_password < /dev/tty - echo >&2 - else - read -r -s -p "sudo password for ${SSH_USER} on remote hosts: " sudo_password - echo >&2 - fi + read -r -s -p "sudo password for ${SSH_USER} on remote hosts: " sudo_password + echo >&2 } locally_managed_hosts() {