Fix stdin: use targeted /dev/tty redirects instead of exec
The exec < /dev/tty approach silently killed the script under set -e if /dev/tty wasn't accessible. Replace with surgical redirects on just the interactive reads and setup.sh invocation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
13
install.sh
13
install.sh
@@ -50,13 +50,6 @@ show_progress() {
|
||||
fi
|
||||
}
|
||||
|
||||
# --- Reclaim stdin for interactive prompts ---
|
||||
# When run via `curl ... | bash`, stdin is the pipe. Reopen it from
|
||||
# the terminal so read prompts (setup wizard, confirmations) work.
|
||||
if [ ! -t 0 ]; then
|
||||
exec < /dev/tty
|
||||
fi
|
||||
|
||||
header "WebsiteBox Installer"
|
||||
|
||||
# --- Check for root/sudo ---
|
||||
@@ -102,7 +95,7 @@ case "$OS_ID" in
|
||||
*)
|
||||
warn "Unsupported OS detected (${OS_ID} ${OS_VERSION})."
|
||||
warn "WebsiteBox is tested on Ubuntu 20.04+ and Debian 11+."
|
||||
read -rp "Continue anyway? (y/N) " cont
|
||||
read -rp "Continue anyway? (y/N) " cont < /dev/tty
|
||||
if [ "$cont" != "y" ] && [ "$cont" != "Y" ]; then
|
||||
exit 1
|
||||
fi
|
||||
@@ -257,9 +250,9 @@ echo ""
|
||||
if [ "$DOCKER_JUST_INSTALLED" = true ] && [ "$ACTUAL_USER" != "root" ]; then
|
||||
# Activate docker group for this session without requiring logout/login
|
||||
info "Activating Docker permissions for current session..."
|
||||
sg docker -c "./setup.sh"
|
||||
sg docker -c "./setup.sh < /dev/tty"
|
||||
else
|
||||
./setup.sh
|
||||
./setup.sh < /dev/tty
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
Reference in New Issue
Block a user