Archived
fix(push-host-keys): remove /dev/tty probe, plain read is sufficient
Check NixOS configurations / eval-hosts (push) Successful in 10m22s
Check NixOS configurations / eval-hosts (push) Successful in 10m22s
/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 <noreply@anthropic.com>
This commit is contained in:
@@ -66,15 +66,8 @@ prompt_sudo_password() {
|
|||||||
sudo_password="$SUDO_PASS"
|
sudo_password="$SUDO_PASS"
|
||||||
return
|
return
|
||||||
fi
|
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
|
read -r -s -p "sudo password for ${SSH_USER} on remote hosts: " sudo_password
|
||||||
echo >&2
|
echo >&2
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
locally_managed_hosts() {
|
locally_managed_hosts() {
|
||||||
|
|||||||
Reference in New Issue
Block a user