From dda909b4ccf3ca44d0f1a80b9ebcc4d06ec0d109 Mon Sep 17 00:00:00 2001 From: delta-cloud-208e Date: Sun, 8 Mar 2026 11:05:45 +0000 Subject: [PATCH] fix(gemini,qwen): replace test prompt with version check in verify step MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gemini -p / qwen -p crashes with "setRawMode EIO" when stdin is not a TTY (running from sudo bash script.sh). Verification now uses --version instead — fast, reliable, no TTY needed. Co-Authored-By: Claude Opus 4.6 --- gemini/ugemini_install.sh | 24 +++++------------------- qwen/uqwen_install.sh | 30 +++++++++++------------------- 2 files changed, 16 insertions(+), 38 deletions(-) diff --git a/gemini/ugemini_install.sh b/gemini/ugemini_install.sh index 7797d33..3d81511 100755 --- a/gemini/ugemini_install.sh +++ b/gemini/ugemini_install.sh @@ -327,23 +327,11 @@ export GOOGLE_GEMINI_BASE_URL="$BASE_URL" # ---- Verify ---- info "Verifying..." -echo "" -# Portable timeout (macOS may not have it) -run_with_timeout() { - if command -v timeout &>/dev/null; then - timeout 30 "$@" - elif command -v gtimeout &>/dev/null; then - gtimeout 30 "$@" - else - "$@" - fi -} - -RESULT=$(run_with_timeout gemini -p "Reply with just OK" 2>&1 || true) -if echo "$RESULT" | grep -qi "OK"; then +if gemini --version &>/dev/null; then + VER=$(gemini --version 2>/dev/null || echo "unknown") echo "" - echo -e "${GREEN}${BOLD} Gemini CLI installed and patched!${RESET}" + echo -e "${GREEN}${BOLD} Gemini CLI v$VER installed and patched!${RESET}" echo "" echo " Usage:" echo " gemini # interactive mode" @@ -356,8 +344,6 @@ if echo "$RESULT" | grep -qi "OK"; then echo " Env vars auto-loaded by wrapper. Works in any shell." echo "" else - warn "Patches applied but test prompt failed." - echo " Response: $RESULT" - echo "" - echo " Try manually: gemini -p 'Hello'" + err "gemini wrapper not working" + exit 1 fi diff --git a/qwen/uqwen_install.sh b/qwen/uqwen_install.sh index 4828e0a..6a9c85c 100755 --- a/qwen/uqwen_install.sh +++ b/qwen/uqwen_install.sh @@ -242,26 +242,18 @@ export QWEN_BASE_URL="$BASE_URL" # ---- Verify ---- info "Verifying..." -echo "" -if [ -n "$QWEN_BIN" ]; then - RESULT=$(timeout 30 "$QWEN_BIN" -p "Reply with just OK" 2>&1 || true) - if echo "$RESULT" | grep -qi "OK"; then - echo "" - echo -e "${GREEN}${BOLD} Qwen Code installed and patched!${RESET}" - echo "" - echo " Usage:" - echo " $QWEN_BIN # interactive mode" - echo " $QWEN_BIN -p \"Your prompt\" # single prompt" - echo "" - echo " Env vars auto-loaded by wrapper. Works in any shell." - echo "" - else - warn "Patches applied but test prompt failed." - echo " Response: $RESULT" - echo "" - echo " Try manually: $QWEN_BIN -p 'Hello'" - fi +if [ -n "$QWEN_BIN" ] && "$QWEN_BIN" --version &>/dev/null; then + VER=$("$QWEN_BIN" --version 2>/dev/null || echo "unknown") + echo "" + echo -e "${GREEN}${BOLD} Qwen Code v$VER installed and patched!${RESET}" + echo "" + echo " Usage:" + echo " $QWEN_BIN # interactive mode" + echo " $QWEN_BIN -p \"Your prompt\" # single prompt" + echo "" + echo " Env vars auto-loaded by wrapper. Works in any shell." + echo "" else warn "Qwen binary not found in PATH after install." echo " Check: npm list -g ${NPM_PACKAGE}"