























@@ -94,6 +94,58 @@ describe("setup-pnpm-store-cache ensure-node", () => {
9494}
9595});
969697+it("normalizes Windows toolcache paths for Git Bash before prepending PATH", () => {
98+const root = mkdtempSync(join(tmpdir(), "openclaw-ensure-node-"));
99+try {
100+const activeBin = join(root, "active", "bin");
101+writeFakeNode(activeBin, "22.22.3");
102+const toolcacheBin = join(root, "toolcache", "node", "24.15.0", "x64");
103+const toolcacheNode = writeFakeNode(toolcacheBin, "24.15.0");
104+const helperBin = join(root, "helpers");
105+mkdirSync(helperBin, { recursive: true });
106+const cygpath = join(helperBin, "cygpath");
107+writeFileSync(
108+cygpath,
109+`#!/usr/bin/env bash
110+if [[ "$1" == "-u" ]]; then
111+ echo "${toolcacheBin}"
112+ exit 0
113+fi
114+if [[ "$1" == "-w" ]]; then
115+ echo "C:\\\\hostedtoolcache\\\\windows\\\\node\\\\24.15.0\\\\x64"
116+ exit 0
117+fi
118+exit 1
119+`,
120+);
121+chmodSync(cygpath, 0o755);
122+const githubPath = join(root, "github-path");
123+const result = spawnSync(
124+"bash",
125+[
126+"-c",
127+[
128+"set -e",
129+`export PATH=${JSON.stringify(`${helperBin}:${activeBin}:${process.env.PATH ?? ""}`)}`,
130+`export GITHUB_PATH=${JSON.stringify(githubPath)}`,
131+`source "${ensureNodeScript}"`,
132+`openclaw_prepend_node_bin "C:\\\\hostedtoolcache\\\\windows/node/24.15.0/x64"`,
133+"command -v node",
134+"node -p 'process.versions.node'",
135+`cat "${githubPath}"`,
136+].join("; "),
137+],
138+{ encoding: "utf8", env: process.env },
139+);
140+141+expect(result.status).toBe(0);
142+expect(result.stdout).toContain(`${toolcacheNode}\n24.15.0`);
143+expect(result.stdout).toContain("C:\\hostedtoolcache\\windows\\node\\24.15.0\\x64");
144+} finally {
145+rmSync(root, { recursive: true, force: true });
146+}
147+});
148+97149it("repairs PATH from the container-mounted GitHub Actions toolcache", () => {
98150const root = mkdtempSync(join(tmpdir(), "openclaw-ensure-node-"));
99151try {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。