From 3ab313a11aa3fa4d700e9d46b86541d446186e82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=BE=B7=E5=AE=87?= Date: Sat, 3 Oct 2026 13:47:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=94=9F=E6=88=90?= =?UTF-8?q?=E7=BB=91=E5=AE=9A=E6=A0=A1=E9=AA=8C=E5=9C=A8=20Windows=20?= =?UTF-8?q?=E4=B8=8A=E6=97=A0=E6=B3=95=E6=89=A7=E8=A1=8C=20npx.cmd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - check-generated-bindings.mjs:run() 的 spawnSync 增加 shell: process.platform === 'win32' - Windows 上不带 shell 无法执行 .cmd/.bat(Node 修 CVE-2024-27980 后报 EINVAL),npxCommand 特意换成 npx.cmd 只把 ENOENT 换成了 EINVAL,prettier 这一步仍然跑不起来 - 与 scripts/database-backup-to-oss.mjs、lint-staged-rustfmt.mjs 等既有脚本的写法保持一致 - Linux 侧已跑 check:generated-bindings 验证;Windows 路径本机无法实测 --- scripts/check-generated-bindings.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/check-generated-bindings.mjs b/scripts/check-generated-bindings.mjs index 355163474..5039ab1d3 100644 --- a/scripts/check-generated-bindings.mjs +++ b/scripts/check-generated-bindings.mjs @@ -92,7 +92,13 @@ function snapshot(dir) { } function run(command, args) { - const result = spawnSync(command, args, { cwd: repoRoot, encoding: 'utf8' }); + // Windows 上 `.cmd` / `.bat` 不带 shell 无法执行(Node 修 CVE-2024-27980 后直接 EINVAL), + // `npx.cmd` 也不例外;仓库既有脚本统一用 `shell: process.platform === 'win32'`。 + const result = spawnSync(command, args, { + cwd: repoRoot, + encoding: 'utf8', + shell: process.platform === 'win32', + }); if (result.error) { console.error(`无法启动 ${command}:${result.error.message}`); }