INNER CODE UNIT · TypeScript

handleRestartStartWhenStopped

lidge-jun/opencodex · src/cli/index.ts:1001

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);
  }
}
async function handleStop(approval?: StopApproval) {
  const lease = acquireOwnershipMutationLease(serviceStatePaths());
  try {
    if (!approval) return await handleStopUnlocked();
    return await runApprovedStop(

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…