mirror of
https://github.com/Dvorinka/Primora.git
synced 2026-10-28 07:41:23 +00:00
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:
1 parent
bc8b165ad9
commit
40c189c431
1 file changed
+7
-5
+7
-5
@@ -60,11 +60,13 @@ else
|
|||||||
if [ -z "$PUBLIC_URL" ]; then
|
if [ -z "$PUBLIC_URL" ]; then
|
||||||
DEFAULT_URL="http://localhost"
|
DEFAULT_URL="http://localhost"
|
||||||
[ "$NGINX_PORT" != "80" ] && DEFAULT_URL="http://localhost:$NGINX_PORT"
|
[ "$NGINX_PORT" != "80" ] && DEFAULT_URL="http://localhost:$NGINX_PORT"
|
||||||
# Under `curl | bash` stdin is the script pipe — prompt on the
|
# Under `curl | bash` stdin is the script pipe — ask on the controlling
|
||||||
# controlling terminal instead. No tty (CI/cron) → default silently.
|
# terminal instead. `true </dev/tty` probes the open quietly; read's own
|
||||||
if exec 9</dev/tty 2>/dev/null; then
|
# redirect fails non-fatally (default applies) where there is no tty.
|
||||||
read -rp "URL where you'll open Primora (domain or IP, e.g. https://primora.example.com) [$DEFAULT_URL]: " PUBLIC_URL <&9 || true
|
# Never `exec ... 2>/dev/null` here — exec redirections persist and would
|
||||||
exec 9>&-
|
# 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
|
fi
|
||||||
PUBLIC_URL="${PUBLIC_URL:-$DEFAULT_URL}"
|
PUBLIC_URL="${PUBLIC_URL:-$DEFAULT_URL}"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in new issue
Block a user