build: deploy.py 修复 Windows GBK 环境读取 UTF-8 输出崩溃(subprocess 显式 utf-8/replace 编码)
Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -43,8 +43,8 @@ def sh(args, timeout=TIMEOUT):
|
||||
Windows 上 shell=True 交给 cmd.exe,引号语义与 POSIX 不同,
|
||||
提交信息等参数若用 shlex.quote 反而会出错 —— 统一用 list 直传。
|
||||
"""
|
||||
r = subprocess.run(args, capture_output=True, text=True,
|
||||
timeout=timeout, env=ENV)
|
||||
r = subprocess.run(args, capture_output=True, text=True, encoding='utf-8',
|
||||
errors='replace', timeout=timeout, env=ENV)
|
||||
return r.returncode, (r.stdout + r.stderr).strip()
|
||||
|
||||
|
||||
@@ -60,8 +60,8 @@ def remote(cmd, timeout=TIMEOUT):
|
||||
cd 与 cmd 的拼接在 Python 里完成,不走任何 shell 解析。
|
||||
"""
|
||||
args = SSH_BASE.split() + ['cd %s && %s' % (REMOTE_DIR, cmd)]
|
||||
r = subprocess.run(args, capture_output=True, text=True,
|
||||
timeout=timeout, env=ENV)
|
||||
r = subprocess.run(args, capture_output=True, text=True, encoding='utf-8',
|
||||
errors='replace', timeout=timeout, env=ENV)
|
||||
return r.returncode, (r.stdout + r.stderr).strip()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user