From 6bdbb3deb4c1a686f283be95bc162d081636a57b Mon Sep 17 00:00:00 2001 From: Jatin K Malik Date: Sat, 14 Mar 2026 14:16:17 -0700 Subject: [PATCH] fix(install): handle piped bash by redirecting stdin to /dev/tty (#315) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When running via `curl | bash`, stdin (fd 0) is the pipe — not the terminal. The script was setting INTERACTIVE_MODE='ask' and then trying to `read` from the pipe, which returned EOF/garbage, defaulting to interactive mode, which then immediately errored because there was no TTY. Fix: if stdin is a pipe but /dev/tty is accessible, do `exec < /dev/tty` to redirect stdin to the real terminal so user prompts work correctly. If there is truly no terminal (headless/CI), fall back to automatic mode without erroring. Also fix the misleading error message which suggested running the exact same curl|bash command that just failed. --- install.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 388e866..fb802e1 100755 --- a/install.sh +++ b/install.sh @@ -113,11 +113,17 @@ HAS_VULKAN="no" VULKAN_DEVICE="" # Detect if running non-interactively (e.g., via curl | bash) -# Interactive mode is now default, so only auto-detect non-interactive for curl pipes +# If stdin is a pipe but /dev/tty exists, redirect stdin so user input works normally. +# If no terminal is available at all (headless/CI), fall back to automatic mode. if [ ! -t 0 ]; then - # When piped via curl, we'll still try to be interactive if possible - # User can force non-interactive with --auto - INTERACTIVE_MODE="ask" + if [ -e /dev/tty ] && [ -r /dev/tty ]; then + exec < /dev/tty + INTERACTIVE_MODE="ask" + else + AUTO_MODE="yes" + INTERACTIVE_MODE="no" + NON_INTERACTIVE="yes" + fi fi while [[ $# -gt 0 ]]; do @@ -1089,8 +1095,8 @@ if [[ "$INTERACTIVE_MODE" == "yes" ]]; then # Check if we have a TTY (required for interactive mode) if [ ! -t 0 ]; then print_error "Interactive mode requires a terminal (TTY)." - print_error "Please run from a terminal, or use automatic mode:" - print_error " curl -fsSL https://raw.githubusercontent.com/jatinkrmalik/vocalinux/main/install.sh | bash" + print_error "Download and run the installer directly from a terminal:" + print_error " curl -fsSL https://raw.githubusercontent.com/jatinkrmalik/vocalinux/main/install.sh -o /tmp/vl.sh && bash /tmp/vl.sh" exit 1 fi