From 56b3fb7f4cb9404b0a389e202b57b2e968fbe347 Mon Sep 17 00:00:00 2001 From: Douwe Osinga Date: Thu, 14 May 2026 12:49:54 -0400 Subject: [PATCH] fix: handle non-interactive terminal in goose configure on Windows When installing via 'curl ... | bash', stdin is a pipe rather than a TTY. On Windows/Git Bash, cliclack fails with 'Incorrect function (os error 1)' when trying to set terminal raw mode on the piped stdin. Two fixes: - install script: detect non-TTY stdin and redirect from /dev/tty when available, or skip configure with a helpful message - goose configure: check stdin.is_terminal() upfront and bail with a clear message instead of crashing Fixes #5910 Signed-off-by: Douwe Osinga --- crates/goose-cli/src/commands/configure.rs | 8 ++++++++ download_cli.sh | 10 +++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/goose-cli/src/commands/configure.rs b/crates/goose-cli/src/commands/configure.rs index c682724276cd..ff25e6667612 100644 --- a/crates/goose-cli/src/commands/configure.rs +++ b/crates/goose-cli/src/commands/configure.rs @@ -30,12 +30,20 @@ use goose::providers::{create, providers, retry_operation, RetryConfig}; use goose::session::SessionType; use serde_json::Value; use std::collections::HashMap; +use std::io::IsTerminal; // useful for light themes where there is no discernible colour contrast between // cursor-selected and cursor-unselected items. const MULTISELECT_VISIBILITY_HINT: &str = "<"; pub async fn handle_configure() -> anyhow::Result<()> { + if !std::io::stdin().is_terminal() { + anyhow::bail!( + "goose configure requires an interactive terminal.\n\ + If you installed via 'curl ... | bash', run 'goose configure' separately after installation." + ); + } + let config = Config::global(); if !config.exists() { diff --git a/download_cli.sh b/download_cli.sh index 2d7c0d41f325..ca08485c5767 100755 --- a/download_cli.sh +++ b/download_cli.sh @@ -310,7 +310,15 @@ if [ "$CONFIGURE" = true ]; then echo "" echo "Configuring goose" echo "" - "$GOOSE_BIN_DIR/$OUT_FILE" configure + if [ -t 0 ]; then + "$GOOSE_BIN_DIR/$OUT_FILE" configure + elif [ -r /dev/tty ]; then + "$GOOSE_BIN_DIR/$OUT_FILE" configure < /dev/tty + else + echo "Non-interactive shell detected (e.g. 'curl ... | bash')." + echo "Skipping 'goose configure' — please run it manually after installation:" + echo " $GOOSE_BIN_DIR/$OUT_FILE configure" + fi else echo "Skipping 'goose configure', you may need to run this manually later" fi