


























@@ -2,6 +2,8 @@
22import { spawnSync } from "node:child_process";
33import fs from "node:fs";
44import path from "node:path";
5+import { pathToFileURL } from "node:url";
6+import { buildCmdExeCommandLine } from "../../../windows-cmd-helpers.mjs";
5768const args = process.argv.slice(2);
79const command = args.shift();
@@ -195,15 +197,38 @@ function adaptStepForBaseline(step, baselineVersion, summary) {
195197return step;
196198}
197199200+export function resolveUpgradeSurvivorOpenClawCommand(argv, params = {}) {
201+const platform = params.platform ?? process.platform;
202+if (platform === "win32") {
203+const comSpec = params.comSpec ?? process.env.ComSpec ?? "cmd.exe";
204+return {
205+command: comSpec,
206+args: ["/d", "/s", "/c", buildCmdExeCommandLine("openclaw.cmd", argv)],
207+commandLabel: ["openclaw", ...argv].join(" "),
208+shell: false,
209+windowsVerbatimArguments: true,
210+};
211+}
212+return {
213+command: "openclaw",
214+args: argv,
215+commandLabel: ["openclaw", ...argv].join(" "),
216+shell: false,
217+};
218+}
219+198220function runOpenClaw(step) {
199-const result = spawnSync("openclaw", step.argv, {
221+const invocation = resolveUpgradeSurvivorOpenClawCommand(step.argv);
222+const result = spawnSync(invocation.command, invocation.args, {
200223encoding: "utf8",
201224env: process.env,
225+shell: invocation.shell,
226+windowsVerbatimArguments: invocation.windowsVerbatimArguments,
202227});
203228return {
204229id: step.id,
205230intent: step.intent,
206-command: ["openclaw", ...step.argv].join(" "),
231+command: invocation.commandLabel,
207232status: result.status,
208233signal: result.signal,
209234ok: result.status === 0,
@@ -252,8 +277,14 @@ function applyRecipe() {
252277}
253278}
254279255-if (command === "apply") {
256-applyRecipe();
257-} else {
258-throw new Error(`unknown upgrade-survivor config-recipe command: ${command ?? "<missing>"}`);
280+function main() {
281+if (command === "apply") {
282+applyRecipe();
283+} else {
284+throw new Error(`unknown upgrade-survivor config-recipe command: ${command ?? "<missing>"}`);
285+}
286+}
287+288+if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
289+main();
259290}
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。