

























@@ -7,16 +7,22 @@ import { describe, expect, it } from "vitest";
77const SCRIPT_PATH = "scripts/install.sh";
8899function runInstallShell(script: string, env: NodeJS.ProcessEnv = {}) {
10-return spawnSync("bash", ["-c", script], {
11-encoding: "utf8",
12-env: {
13- ...process.env,
14- ...env,
15-BASH_ENV: "",
16-ENV: "",
17-OPENCLAW_INSTALL_SH_NO_RUN: "1",
18-},
19-});
10+const home = mkdtempSync(join(tmpdir(), "openclaw-install-home-"));
11+try {
12+return spawnSync("bash", ["-c", script], {
13+encoding: "utf8",
14+env: {
15+ ...process.env,
16+HOME: home,
17+ ...env,
18+BASH_ENV: "",
19+ENV: "",
20+OPENCLAW_INSTALL_SH_NO_RUN: "1",
21+},
22+});
23+} finally {
24+rmSync(home, { force: true, recursive: true });
25+}
2026}
21272228function writeNpmFreshnessConflictFixture(path: string, argsLog: string) {
@@ -1006,6 +1012,8 @@ describe("install.sh", () => {
10061012`cd ${JSON.stringify(process.cwd())}`,
10071013`source ${JSON.stringify(SCRIPT_PATH)}`,
10081014"set +e",
1015+`PATH=${JSON.stringify(`${bin}:/usr/bin:/bin`)}`,
1016+"export PATH",
10091017"unset -f node 2>/dev/null || true",
10101018"unalias node 2>/dev/null || true",
10111019'node() { printf "%s\\n" "${FAKE_NODE_VERSION:-v0.0.0}"; }',
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。