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 ----
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

View File

@@ -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}"