mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-10 10:42:43 +00:00
fix(daemon): avoid freezing Windows PATH in task scripts (#39139, thanks @Narcooo)
Co-authored-by: majx_mac <mjxnarco@pku.edu.cn>
This commit is contained in:
@@ -268,7 +268,7 @@ describe("buildServiceEnvironment", () => {
|
||||
});
|
||||
expect(env.HOME).toBe("/home/user");
|
||||
if (process.platform === "win32") {
|
||||
expect(env.PATH).toBe("");
|
||||
expect(env).not.toHaveProperty("PATH");
|
||||
} else {
|
||||
expect(env.PATH).toContain("/usr/bin");
|
||||
}
|
||||
@@ -331,6 +331,20 @@ describe("buildServiceEnvironment", () => {
|
||||
expect(env.http_proxy).toBe("http://proxy.local:7890");
|
||||
expect(env.all_proxy).toBe("socks5://proxy.local:1080");
|
||||
});
|
||||
|
||||
it("omits PATH on Windows so Scheduled Tasks can inherit the current shell path", () => {
|
||||
const env = buildServiceEnvironment({
|
||||
env: {
|
||||
HOME: "C:\\Users\\alice",
|
||||
PATH: "C:\\Windows\\System32;C:\\Tools\\rg",
|
||||
},
|
||||
port: 18789,
|
||||
platform: "win32",
|
||||
});
|
||||
|
||||
expect(env).not.toHaveProperty("PATH");
|
||||
expect(env.OPENCLAW_WINDOWS_TASK_NAME).toBe("OpenClaw Gateway");
|
||||
});
|
||||
});
|
||||
|
||||
describe("buildNodeServiceEnvironment", () => {
|
||||
|
||||
Reference in New Issue
Block a user