(line: string)
| 12 | let originalWrite: typeof process.stdout.write | null = null |
| 13 | |
| 14 | function isJsonLine(line: string): boolean { |
| 15 | // Empty lines are tolerated in NDJSON streams — treat them as valid so a |
| 16 | // trailing newline or a blank separator doesn't trip the guard. |
| 17 | if (line.length === 0) { |
| 18 | return true |
| 19 | } |
| 20 | try { |
| 21 | JSON.parse(line) |
| 22 | return true |
| 23 | } catch { |
| 24 | return false |
| 25 | } |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Install a runtime guard on process.stdout.write for --output-format=stream-json. |
no test coverage detected