MCPcopy Index your code
hub / github.com/claude-code-best/claude-code / getStdout

Method getStdout

src/utils/task/TaskOutput.ts:282–295  ·  view source on GitHub ↗

* Get stdout. In file mode, reads from the output file. * In pipe mode, returns the in-memory buffer or tail from CircularBuffer.

()

Source from the content-addressed store, hash-verified

280 * In pipe mode, returns the in-memory buffer or tail from CircularBuffer.
281 */
282 async getStdout(): Promise<string> {
283 if (this.stdoutToFile) {
284 return this.#readStdoutFromFile()
285 }
286 // Pipe mode (hooks) — use in-memory data
287 if (this.#disk) {
288 const recent = this.#recentLines.getRecent(5)
289 const tail = safeJoinLines(recent, '\n')
290 const sizeKB = Math.round(this.#totalBytes / 1024)
291 const notice = `\nOutput truncated (${sizeKB}KB total). Full output saved to: ${this.path}`
292 return tail ? tail + notice : notice.trimStart()
293 }
294 return this.#stdoutBuffer
295 }
296
297 async #readStdoutFromFile(): Promise<string> {
298 const maxBytes = getMaxOutputLength()

Callers 6

getTaskOutputDataFunction · 0.80
executeInBackgroundFunction · 0.80
#handleExitMethod · 0.80
registerPendingAsyncHookFunction · 0.80
finalizeHookFunction · 0.80

Calls 3

#readStdoutFromFileMethod · 0.95
safeJoinLinesFunction · 0.85
getRecentMethod · 0.80

Tested by

no test coverage detected