fix(release): wrap bare Windows npm execpath · openclaw/openclaw@688ecb1
vincentkoc
·
2026-06-19
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -516,6 +516,13 @@ export function resolveNpmCommandInvocation(
|
516 | 516 | if (platform === "win32" && name.endsWith(".exe")) { |
517 | 517 | return { command: npmExecPath, args: npmArgs }; |
518 | 518 | } |
| 519 | +if (platform === "win32" && name === "npm") { |
| 520 | +return { |
| 521 | +command: params.comSpec ?? process.env.ComSpec ?? "cmd.exe", |
| 522 | +args: ["/d", "/s", "/c", buildCmdExeCommandLine(`${npmExecPath}.cmd`, npmArgs)], |
| 523 | +windowsVerbatimArguments: true, |
| 524 | +}; |
| 525 | +} |
519 | 526 | if (name.endsWith(".js") || name.endsWith(".cjs") || name.endsWith(".mjs")) { |
520 | 527 | return { command: nodeExecPath, args: [npmExecPath, ...npmArgs] }; |
521 | 528 | } |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -349,6 +349,21 @@ describe("resolveNpmCommandInvocation", () => {
|
349 | 349 | }); |
350 | 350 | }); |
351 | 351 | |
| 352 | +it("wraps bare Windows npm_execpath through npm.cmd", () => { |
| 353 | +expect( |
| 354 | +resolveNpmCommandInvocation({ |
| 355 | +comSpec: "C:\\Windows\\System32\\cmd.exe", |
| 356 | +npmArgs: ["view", "openclaw@beta", "version"], |
| 357 | +npmExecPath: "npm", |
| 358 | +platform: "win32", |
| 359 | +}), |
| 360 | +).toEqual({ |
| 361 | +command: "C:\\Windows\\System32\\cmd.exe", |
| 362 | +args: ["/d", "/s", "/c", "npm.cmd view openclaw@beta version"], |
| 363 | +windowsVerbatimArguments: true, |
| 364 | +}); |
| 365 | +}); |
| 366 | + |
352 | 367 | it("wraps Windows npm_execpath command shims", () => { |
353 | 368 | expect( |
354 | 369 | resolveNpmCommandInvocation({ |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。