From ce44fcbb744ab96fd7658357260aa03c051cc1af Mon Sep 17 00:00:00 2001 From: Tesi Date: Tue, 27 Jan 2026 05:46:00 +0000 Subject: [PATCH] Skip optional prompts in non-interactive mode When running via `curl | bash`, stdin is not a tty, so interactive prompts block forever. Detect non-interactive mode and skip optional prompts (like bash-completion) with sensible defaults. Changes: - Add INTERACTIVE flag based on tty detection - Skip bash-completion prompt in non-interactive mode Co-Authored-By: Claude Opus 4.5 --- install.sh | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 9942773..53625fc 100755 --- a/install.sh +++ b/install.sh @@ -22,6 +22,12 @@ fi set -e +# Detect non-interactive mode (curl | bash) +INTERACTIVE=true +if [[ ! -t 0 ]]; then + INTERACTIVE=false +fi + # Colors for output RED='\033[0;31m' GREEN='\033[0;32m' @@ -99,13 +105,17 @@ install_macos_deps() { log "✓ Modern bash installed" fi - # Optional: bash-completion + # Optional: bash-completion (skip prompt in non-interactive mode) if ! brew list bash-completion@2 &>/dev/null; then - info "bash-completion@2 not found (optional)" - read -p "Install bash-completion@2 for better tab completion? (y/N) " -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]]; then - deps_to_install+=("bash-completion@2") + if [[ "$INTERACTIVE" == "true" ]]; then + info "bash-completion@2 not found (optional)" + read -p "Install bash-completion@2 for better tab completion? (y/N) " -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + deps_to_install+=("bash-completion@2") + fi + else + info "bash-completion@2 not found (optional, skipping in non-interactive mode)" fi else log "✓ bash-completion@2 installed"