fix(exec): ignore malformed drive-less windows exec paths

This commit is contained in:
SnowSky1
2026-04-01 11:21:47 +08:00
committed by Peter Steinberger
parent a26f4d0f3e
commit e6ce31eb54
4 changed files with 43 additions and 0 deletions

View File

@@ -74,4 +74,16 @@ describe("executable path helpers", () => {
);
expect(resolveExecutablePath("~/missing-tool", { env: { HOME: homeDir } })).toBeUndefined();
});
it("does not treat drive-less rooted windows paths as cwd-relative executables", () => {
if (process.platform !== "win32") {
return;
}
expect(
resolveExecutablePath(String.raw`:\Users\demo\AI\system\openclaw\git.exe`, {
cwd: String.raw`C:\Users\demo\AI\system\openclaw`,
}),
).toBeUndefined();
});
});