fix(canvas): ignore stale pnpm execpath · openclaw/openclaw@1654401
vincentkoc
·
2026-06-21
·
via Recent Commits to openclaw:main
File tree
extensions/canvas/scripts
| Original file line number | Diff line number | Diff line change |
|---|
@@ -98,7 +98,7 @@ function isNodeRunnablePnpmExecPath(value) {
|
98 | 98 | } |
99 | 99 | const { extension } = inspectExecutablePath(value); |
100 | 100 | if (NODE_RUNNABLE_EXTENSIONS.has(extension)) { |
101 | | -return true; |
| 101 | +return isFile(value); |
102 | 102 | } |
103 | 103 | if (extension.length > 0) { |
104 | 104 | return false; |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -80,6 +80,30 @@ describe("canvas pnpm runner", () => {
|
80 | 80 | } |
81 | 81 | }); |
82 | 82 | |
| 83 | +posixIt("ignores a missing pnpm JS npm_execpath before checking PATH", () => { |
| 84 | +const tempDir = mkdtempSync(path.join(os.tmpdir(), "canvas-pnpm-runner-missing-")); |
| 85 | +const corepackPath = path.join(tempDir, "corepack"); |
| 86 | +writeFileSync(corepackPath, "#!/bin/sh\nexit 0\n"); |
| 87 | +chmodSync(corepackPath, 0o755); |
| 88 | + |
| 89 | +try { |
| 90 | +expect( |
| 91 | +resolvePnpmRunner({ |
| 92 | +env: { PATH: tempDir }, |
| 93 | +npmExecPath: path.join(tempDir, "missing-pnpm.mjs"), |
| 94 | +platform: "darwin", |
| 95 | +pnpmArgs: ["exec", "rolldown", "-c"], |
| 96 | +}), |
| 97 | +).toEqual({ |
| 98 | +args: ["pnpm", "exec", "rolldown", "-c"], |
| 99 | +command: corepackPath, |
| 100 | +shell: false, |
| 101 | +}); |
| 102 | +} finally { |
| 103 | +rmSync(tempDir, { recursive: true, force: true }); |
| 104 | +} |
| 105 | +}); |
| 106 | + |
83 | 107 | posixIt("prefers a direct pnpm executable over Corepack", () => { |
84 | 108 | const tempDir = mkdtempSync(path.join(os.tmpdir(), "canvas-pnpm-runner-path-")); |
85 | 109 | const pnpmPath = path.join(tempDir, "pnpm"); |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。