test: fix windows runtime and restart loop harnesses

This commit is contained in:
Peter Steinberger
2026-03-09 07:22:16 +00:00
parent 250d3c949e
commit cc0f30f5fb
2 changed files with 92 additions and 42 deletions

View File

@@ -229,9 +229,16 @@ describe("handleSystemRunInvoke mac app exec host routing", () => {
const tmp = fs.mkdtempSync(path.join(os.tmpdir(), `openclaw-${params.runtime}-path-`));
const binDir = path.join(tmp, "bin");
fs.mkdirSync(binDir, { recursive: true });
const runtimePath = path.join(binDir, params.runtime);
fs.writeFileSync(runtimePath, "#!/bin/sh\nexit 0\n", { mode: 0o755 });
fs.chmodSync(runtimePath, 0o755);
const runtimePath =
process.platform === "win32"
? path.join(binDir, `${params.runtime}.cmd`)
: path.join(binDir, params.runtime);
const runtimeBody =
process.platform === "win32" ? "@echo off\r\nexit /b 0\r\n" : "#!/bin/sh\nexit 0\n";
fs.writeFileSync(runtimePath, runtimeBody, { mode: 0o755 });
if (process.platform !== "win32") {
fs.chmodSync(runtimePath, 0o755);
}
const oldPath = process.env.PATH;
process.env.PATH = `${binDir}${path.delimiter}${oldPath ?? ""}`;
try {