mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-27 00:17:29 +00:00
fix(daemon): accept 'Last Result' schtasks key variant on Windows (#47726)
Some Windows locales/versions emit 'Last Result' instead of 'Last Run Result' in schtasks output, causing gateway status to falsely report 'Runtime: unknown'. Fall back to the shorter key when the canonical key is absent.
This commit is contained in:
committed by
Peter Steinberger
parent
69c12c2b11
commit
3e8bc9f16a
@@ -23,6 +23,20 @@ describe("schtasks runtime parsing", () => {
|
||||
lastRunResult: "0x0",
|
||||
});
|
||||
});
|
||||
|
||||
it("parses 'Last Result' key variant (without 'Run') (#47726)", () => {
|
||||
const output = [
|
||||
"TaskName: \\OpenClaw Gateway",
|
||||
"Status: Running",
|
||||
"Last Run Time: 2026/3/16 8:34:15",
|
||||
"Last Result: 267009",
|
||||
].join("\r\n");
|
||||
expect(parseSchtasksQuery(output)).toEqual({
|
||||
status: "Running",
|
||||
lastRunTime: "2026/3/16 8:34:15",
|
||||
lastRunResult: "267009",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("scheduled task runtime derivation", () => {
|
||||
|
||||
@@ -178,7 +178,9 @@ export function parseSchtasksQuery(output: string): ScheduledTaskInfo {
|
||||
if (lastRunTime) {
|
||||
info.lastRunTime = lastRunTime;
|
||||
}
|
||||
const lastRunResult = entries["last run result"];
|
||||
// Some Windows locales/versions emit "Last Result" instead of "Last Run Result".
|
||||
// Accept both so gateway status is not falsely reported as "unknown" (#47726).
|
||||
const lastRunResult = entries["last run result"] ?? entries["last result"];
|
||||
if (lastRunResult) {
|
||||
info.lastRunResult = lastRunResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user