fix: handle non-interactive terminal in goose configure on Windows (#9214)

Signed-off-by: Douwe Osinga <douwe@squareup.com>
Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2026-05-14 13:25:43 -04:00
committed by GitHub
parent ffd2349b0e
commit 44b1e74bd6
2 changed files with 17 additions and 1 deletions
@@ -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() {
+9 -1
View File
@@ -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