fix(gemini,qwen): replace test prompt with version check in verify step

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 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-03-08 11:05:45 +00:00
parent f8d1213440
commit dda909b4cc
2 changed files with 16 additions and 38 deletions

View File

@@ -327,23 +327,11 @@ export GOOGLE_GEMINI_BASE_URL="$BASE_URL"
# ---- Verify ---- # ---- Verify ----
info "Verifying..." info "Verifying..."
echo ""
# Portable timeout (macOS may not have it) if gemini --version &>/dev/null; then
run_with_timeout() { VER=$(gemini --version 2>/dev/null || echo "unknown")
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
echo "" 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 ""
echo " Usage:" echo " Usage:"
echo " gemini # interactive mode" 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 " Env vars auto-loaded by wrapper. Works in any shell."
echo "" echo ""
else else
warn "Patches applied but test prompt failed." err "gemini wrapper not working"
echo " Response: $RESULT" exit 1
echo ""
echo " Try manually: gemini -p 'Hello'"
fi fi

View File

@@ -242,13 +242,11 @@ export QWEN_BASE_URL="$BASE_URL"
# ---- Verify ---- # ---- Verify ----
info "Verifying..." info "Verifying..."
echo ""
if [ -n "$QWEN_BIN" ]; then if [ -n "$QWEN_BIN" ] && "$QWEN_BIN" --version &>/dev/null; then
RESULT=$(timeout 30 "$QWEN_BIN" -p "Reply with just OK" 2>&1 || true) VER=$("$QWEN_BIN" --version 2>/dev/null || echo "unknown")
if echo "$RESULT" | grep -qi "OK"; then
echo "" echo ""
echo -e "${GREEN}${BOLD} Qwen Code installed and patched!${RESET}" echo -e "${GREEN}${BOLD} Qwen Code v$VER installed and patched!${RESET}"
echo "" echo ""
echo " Usage:" echo " Usage:"
echo " $QWEN_BIN # interactive mode" echo " $QWEN_BIN # interactive mode"
@@ -256,12 +254,6 @@ if [ -n "$QWEN_BIN" ]; then
echo "" echo ""
echo " Env vars auto-loaded by wrapper. Works in any shell." echo " Env vars auto-loaded by wrapper. Works in any shell."
echo "" echo ""
else
warn "Patches applied but test prompt failed."
echo " Response: $RESULT"
echo ""
echo " Try manually: $QWEN_BIN -p 'Hello'"
fi
else else
warn "Qwen binary not found in PATH after install." warn "Qwen binary not found in PATH after install."
echo " Check: npm list -g ${NPM_PACKAGE}" echo " Check: npm list -g ${NPM_PACKAGE}"