MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / finish

Function finish

apps/kimi-code/src/cli/update/preflight.ts:557–604  ·  view source on GitHub ↗
(succeeded: boolean)

Source from the content-addressed store, hash-verified

555 let settled = false;
556
557 const finish = (succeeded: boolean): void => {
558 if (settled) return;
559 settled = true;
560 const attempts = failureAttemptsFor(startedState, target) + 1;
561
562 const nextState: UpdateInstallState = succeeded
563 ? {
564 ...startedState,
565 active: null,
566 lastFailure: null,
567 lastSuccess: {
568 version: target.version,
569 installedAt: nowIso(),
570 notifiedAt: null,
571 },
572 }
573 : {
574 ...startedState,
575 active: null,
576 lastFailure: {
577 version: target.version,
578 failedAt: nowIso(),
579 attempts,
580 },
581 };
582 void writeUpdateInstallState(nextState).catch(() => {});
583 if (succeeded) {
584 trackUpdateEvent(track, 'update_background_install_succeeded', {
585 target_version: target.version,
586 source,
587 });
588 logUpdateInfo(logger, 'background update install succeeded', {
589 targetVersion: target.version,
590 source,
591 });
592 return;
593 }
594 trackUpdateEvent(track, 'update_background_install_failed', {
595 target_version: target.version,
596 source,
597 attempts,
598 });
599 logUpdateWarn(logger, 'background update install failed', {
600 targetVersion: target.version,
601 source,
602 attempts,
603 });
604 };
605
606 const child = spawn(cmd, [...args], {
607 detached: true,

Callers 1

startBackgroundInstallFunction · 0.70

Calls 6

writeUpdateInstallStateFunction · 0.90
failureAttemptsForFunction · 0.85
nowIsoFunction · 0.85
trackUpdateEventFunction · 0.85
logUpdateInfoFunction · 0.85
logUpdateWarnFunction · 0.85

Tested by

no test coverage detected