INNER CODE UNIT · TypeScript
handleTrayProxyRestart
lidge-jun/opencodex · src/cli/index.ts:995
async function handleTrayProxyRestart(): Promise<void> {
// A service start has no child handle here; its failed result is ambiguous.
await handleProxyRestart(async () => (await handleTrayProxyStart(false))
? { status: "started" }
: { status: "failed", launch: "unknown" });
}
async function handleRestartStartWhenStopped(recoveringLiveRestart = false): Promise<ProxyRestartStartOutcome> {
if (!recoveringLiveRestart && !codexAutoStartEnabled(loadConfig())) {
console.log("Codex autostart is disabled; no proxy was started.");
return { status: "skipped" };
}
let child: ReturnType<typeof spawn> | null = null;
try {
const started = await handleEnsure({ existingIsSuccess: false, forceStart: recoveringLiveRestart, onSpawn: spawned => { child = spawned; } });
return restartStartOutcome(started, child);
} catch (error) {
return restartStartOutcome(false, child, error);
}