fix: handle non-interactive terminal scenarios in setup script

This commit is contained in:
Linus Rath
2026-03-13 00:58:06 +01:00
parent 46a80f3773
commit 5e2329b55f
+7 -1
View File
@@ -1028,6 +1028,12 @@ load_existing_config() {
# When piped (e.g. curl | bash), reopen stdin from the terminal # When piped (e.g. curl | bash), reopen stdin from the terminal
if [[ -t 0 ]]; then if [[ -t 0 ]]; then
main "$@" main "$@"
else elif [[ -r /dev/tty ]] 2>/dev/null && (echo < /dev/tty) 2>/dev/null; then
main "$@" < /dev/tty main "$@" < /dev/tty
else
echo "Error: No interactive terminal available."
echo "Download and run the script directly instead:"
echo " curl -fsSL https://raw.githubusercontent.com/rathlinus/jmap-webmail/main/setup.sh -o setup.sh"
echo " bash setup.sh --dry-run"
exit 1
fi fi