修复:生成绑定校验在 Windows 上无法执行 npx.cmd
- 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 路径本机无法实测
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user