From 37fbd6671d0a1d268b6795dfeb9196b242234026 Mon Sep 17 00:00:00 2001 From: Peanut Date: Thu, 21 May 2026 22:18:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=83=A8=E7=BD=B2=E8=84=9A=E6=9C=AC?= =?UTF-8?q?=E8=BE=93=E5=87=BA=E7=BC=93=E5=86=B2=E5=AF=BC=E8=87=B4=E6=97=A5?= =?UTF-8?q?=E5=BF=97=E4=B8=8D=E5=AE=9E=E6=97=B6=E6=89=93=E5=8D=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit io.TextIOWrapper 默认使用块缓冲,子脚本长时间输出时被缓冲不显示。 添加 line_buffering=True 确保每行实时刷新到终端。 Co-Authored-By: Claude Opus 4.7 --- deploy.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy.py b/deploy.py index ff57f1c..554ecf3 100644 --- a/deploy.py +++ b/deploy.py @@ -29,8 +29,8 @@ from pathlib import Path # 强制 stdout/stderr 使用 UTF-8 编码,避免 Windows GBK 编码错误 if hasattr(sys.stdout, 'buffer'): - sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace') - sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace') + sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8', errors='replace', line_buffering=True) + sys.stderr = io.TextIOWrapper(sys.stderr.buffer, encoding='utf-8', errors='replace', line_buffering=True) # ============================================================================ # 配置