/** *AttempttorestartthisprocesswithafreshPID. *-supervisedenvironments(launchd/systemd/schtasks):callershouldexitandletsupervisorrestart *-OPENCLAW_NO_RESPAWN=1:callershouldkeepin-processrestartbehavior(tests/dev) *-otherwise:spawndetachedchildwithcurrentargv/execArgv,thencallerexits
*/
export function restartGatewayProcessWithFreshPid(): GatewayRespawnResult { if (isTruthy(process.env.OPENCLAW_NO_RESPAWN)) { return { mode: "disabled" };
} const supervisor = detectRespawnSupervisor(process.env); if (supervisor) { // On macOS launchd, exit cleanly and let KeepAlive relaunch the service. // Avoid detached kickstart/start handoffs here so restart timing stays tied // to launchd's native supervision rather than a second helper process. if (supervisor === "schtasks") { const restart = triggerOpenClawRestart(); if (!restart.ok) { return {
mode: "failed",
detail: restart.detail ?? `${restart.method} restart failed`,
};
}
} return { mode: "supervised" };
} if (process.platform === "win32") { // Detached respawn is unsafe on Windows without an identified Scheduled Task: // the child becomes orphaned if the original process exits. return {
mode: "disabled",
detail: "win32: detached respawn unsupported without Scheduled Task markers",
};
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.