(obj: unknown)
| 122 | } |
| 123 | |
| 124 | function writeLine(obj: unknown): void { |
| 125 | try { |
| 126 | stdout.write(JSON.stringify(obj) + "\n"); |
| 127 | } catch (err) { |
| 128 | if (logToStderr) { |
| 129 | process.stderr.write( |
| 130 | `bridge.stdio.write.err: ${err instanceof Error ? err.message : String(err)}\n`, |
| 131 | ); |
| 132 | } |
| 133 | } |
| 134 | } |
| 135 | |
| 136 | function writeNotification<P>(method: string, params: P): void { |
| 137 | writeLine({ jsonrpc: "2.0", method, params }); |
no test coverage detected