* Get stdout. In file mode, reads from the output file. * In pipe mode, returns the in-memory buffer or tail from CircularBuffer.
()
| 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() |
no test coverage detected