fix(install): stop exec from silencing the tty prompt (#47)

exec 9</dev/tty 2>/dev/null inside the if condition redirected the whole
shell's stderr to /dev/null permanently — the read -p prompt then wrote
into the void, leaving the installer blocked on an invisible question.
Replace with a plain </dev/tty redirect on read itself plus a quiet
true </dev/tty probe: the prompt displays, answers land, and no-tty
runs fall back to the default without error noise or the exec
redirect-failure shell-exit hazard.

Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
Tomáš DvořákandDevin authored and GitHub committed 2026-09-28 21:39:54 +02:00
1 parent bc8b165ad9
commit 40c189c431
1 file changed
+7 -5
+7 -5
View File
@@ -60,11 +60,13 @@ else
if [ -z "$PUBLIC_URL" ]; then
DEFAULT_URL="http://localhost"
[ "$NGINX_PORT" != "80" ] && DEFAULT_URL="http://localhost:$NGINX_PORT"
# Under `curl | bash` stdin is the script pipe — prompt on the
# controlling terminal instead. No tty (CI/cron) → default silently.
if exec 9</dev/tty 2>/dev/null; then
read -rp "URL where you'll open Primora (domain or IP, e.g. https://primora.example.com) [$DEFAULT_URL]: " PUBLIC_URL <&9 || true
exec 9>&-
# Under `curl | bash` stdin is the script pipe — ask on the controlling
# terminal instead. `true </dev/tty` probes the open quietly; read's own
# redirect fails non-fatally (default applies) where there is no tty.
# Never `exec ... 2>/dev/null` here — exec redirections persist and would
# silence stderr, including the read prompt below, for the whole script.
if true 2>/dev/null </dev/tty; then
read -rp "URL where you'll open Primora (domain or IP, e.g. https://primora.example.com) [$DEFAULT_URL]: " PUBLIC_URL </dev/tty || true
fi
PUBLIC_URL="${PUBLIC_URL:-$DEFAULT_URL}"
fi