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

Method finishShellOutput

apps/kimi-code/src/tui/kimi-tui.ts:1029–1054  ·  view source on GitHub ↗
(
    commandId: string,
    stdout: string,
    stderr: string,
    isError?: boolean,
    backgrounded?: boolean,
  )

Source from the content-addressed store, hash-verified

1027 }
1028
1029 private finishShellOutput(
1030 commandId: string,
1031 stdout: string,
1032 stderr: string,
1033 isError?: boolean,
1034 backgrounded?: boolean,
1035 ): void {
1036 const stream = this.shellOutputStreams.get(commandId);
1037 if (stream === undefined) return;
1038 if (backgrounded === true) {
1039 // The command was moved to the background; detachRunningShellCommand owns
1040 // the UI and the model notification, so there is nothing to render here.
1041 return;
1042 }
1043 stream.component.finish(stdout, stderr, isError);
1044 // Keep the transcript entry's metadata in sync for anything that reads it
1045 // (export / copy). The component renders itself.
1046 stream.entry.content = formatBashOutputForDisplay(stdout, stderr, isError);
1047 this.shellOutputStreams.delete(commandId);
1048 // When the last shell command finishes, leave the shell streaming phase,
1049 // release one queued message (if any), and refresh the activity pane.
1050 if (this.shellOutputStreams.size === 0) {
1051 this.setAppState({ streamingPhase: 'idle' });
1052 this.drainOneQueuedMessage();
1053 }
1054 }
1055
1056 private drainOneQueuedMessage(): void {
1057 const item = this.shiftQueuedMessage();

Callers 1

Calls 6

setAppStateMethod · 0.95
drainOneQueuedMessageMethod · 0.95
getMethod · 0.65
finishMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected