From 2a5b51aa8dfd8a87264fd22013ebc3123c241bd7 Mon Sep 17 00:00:00 2001 From: hailin Date: Sun, 1 Feb 2026 22:42:42 -0800 Subject: [PATCH] =?UTF-8?q?fix(deploy-mining):=20ensure=5Fkafka=5Fimage=20?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E5=88=B0=20stderr=20=E9=81=BF=E5=85=8D?= =?UTF-8?q?=E8=A2=AB=20$()=20=E6=8D=95=E8=8E=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit docker pull 在 group_info=$(run_kafka_cmd ...) 内执行时,stdout 被命令替换 捕获到变量中,屏幕无任何输出导致脚本看起来卡住。 - ensure_kafka_image 输出重定向到 stderr - full_reset 开头显式预拉取镜像 Co-Authored-By: Claude Opus 4.5 --- backend/services/deploy-mining.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/backend/services/deploy-mining.sh b/backend/services/deploy-mining.sh index 067bafab..b1f34862 100755 --- a/backend/services/deploy-mining.sh +++ b/backend/services/deploy-mining.sh @@ -333,8 +333,9 @@ run_psql() { ensure_kafka_image() { local image="confluentinc/cp-kafka:7.5.0" if ! docker image inspect "$image" &>/dev/null; then - log_info "Pulling Kafka CLI image: $image (first time only)..." - docker pull "$image" + # Output to stderr so it's visible even when called inside $(...) command substitution + echo -e "${BLUE}[INFO]${NC} Pulling Kafka CLI image: $image (first time only)..." >&2 + docker pull "$image" >&2 fi } @@ -1277,6 +1278,9 @@ full_reset() { docker compose $COMPOSE_ARGS up -d postgres-2 redis-2 2>/dev/null || true docker compose $COMPOSE_ARGS up -d --wait postgres-2 redis-2 2>/dev/null || sleep 15 log_success "Standalone infrastructure is up" + + # Pre-pull Kafka CLI image (needed for cross-server kafka commands) + ensure_kafka_image fi log_step "Step 1/19: Stopping 2.0 services..."