





















@@ -271,6 +271,27 @@ describe("installScheduledTask", () => {
271271});
272272});
273273274+it("omits /RU for workgroup accounts so schtasks can use the current local user", async () => {
275+await withUserProfileDir(async (_tmpDir, env) => {
276+schtasksResponses.push(okSchtasksResponse, missingTaskResponse);
277+278+await installDefaultGatewayTask({
279+ ...env,
280+USERDOMAIN: "WORKGROUP",
281+USERNAME: "alice",
282+});
283+284+expectInitialTaskQueries();
285+const createCall = schtasksCalls[2];
286+expect(createCall?.slice(0, 5)).toEqual(["/Create", "/F", "/TN", "OpenClaw Gateway", "/XML"]);
287+expect(createCall).not.toContain("/RU");
288+const captured = xmlPayloadCaptures.find((entry) => entry.index === 2);
289+expect(captured?.xml).toContain("<UserId>alice</UserId>");
290+expect(captured?.xml).not.toContain("<GroupId>S-1-5-32-545</GroupId>");
291+expectTaskRunCall(3);
292+});
293+});
294+274295it("re-applies the XML on /Change so upgraded tasks adopt battery flags (#59299)", async () => {
275296await withUserProfileDir(async (_tmpDir, env) => {
276297// /Query yes, /Query /TN yes, /Change ok, /Create /XML ok (upgrade), /Run ok.
@@ -296,7 +317,9 @@ describe("installScheduledTask", () => {
296317const upgradeCapture = xmlPayloadCaptures.find((entry) => entry.index === 3);
297318expect(upgradeCapture).toBeDefined();
298319const upgradeXml = upgradeCapture?.xml ?? "";
299-expect(upgradeXml).toContain("<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>");
320+expect(upgradeXml).toContain(
321+"<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>",
322+);
300323expect(upgradeXml).toContain("<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>");
301324expectTaskRunCall(4);
302325});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。