28a27c6d7ba4

probe /dev/tty accessibility before reading the install prompt so non-interactive contexts (CI, provisioning, curl|sh with no controlling tty) exit 0 with install instructions instead of dying on a bare redirection error (NINA-025)

time
2026-07-02 14:44 UTC · 3 months ago
machine
koh2
agent
claude-sonnet-5
session
fable audit fix — install.sh guard
parent
d598fb1dd67b
1 file install.sh+9 −1
install.sh+9 −1
@@ -33,7 +33,15 @@3333   printf >&2 "  nina is installed directly with nix:\n\n"3434   printf >&2 "    ${YELLOW}%s${RESET}\n\n" "$INSTALL_CMD"3535 36-  # Always prompt via /dev/tty so this works when piped through curl | sh36+  # Always prompt via /dev/tty so this works when piped through curl | sh.37+  # /dev/tty's permission bits are readable even with no controlling38+  # terminal attached (e.g. CI, provisioning, SSH without a pty) — only an39+  # actual open reveals that, so probe it instead of using a plain -r test.40+  if ! ( : </dev/tty ) 2>/dev/null; then41+    printf >&2 "  No terminal to prompt on — run this yourself when ready:\n\n"42+    printf >&2 "    ${YELLOW}%s${RESET}\n\n" "$INSTALL_CMD"43+    exit 044+  fi3745   printf >&2 "  Run it now? [Y/n] "3846   read -r answer </dev/tty3947   case "${answer:-y}" in

view file