MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / #writeBuffered

Method #writeBuffered

source code/utils/task/TaskOutput.ts:178–202  ·  view source on GitHub ↗
(data: string, isStderr: boolean)

Source from the content-addressed store, hash-verified

176 }
177
178 #writeBuffered(data: string, isStderr: boolean): void {
179 this.#totalBytes += data.length
180
181 this.#updateProgress(data)
182
183 // Write to disk if already overflowed
184 if (this.#disk) {
185 this.#disk.append(isStderr ? `[stderr] ${data}` : data)
186 return
187 }
188
189 // Check if this chunk would exceed the in-memory limit
190 const totalMem =
191 this.#stdoutBuffer.length + this.#stderrBuffer.length + data.length
192 if (totalMem > this.#maxMemory) {
193 this.#spillToDisk(isStderr ? data : null, isStderr ? null : data)
194 return
195 }
196
197 if (isStderr) {
198 this.#stderrBuffer += data
199 } else {
200 this.#stdoutBuffer += data
201 }
202 }
203
204 /**
205 * Single backward pass: count all newlines (for totalLines) and extract

Callers 2

writeStdoutMethod · 0.95
writeStderrMethod · 0.95

Calls 3

#updateProgressMethod · 0.95
#spillToDiskMethod · 0.95
appendMethod · 0.45

Tested by

no test coverage detected