(child: ReturnType<typeof startServer>, payload: unknown)
| 119 | } |
| 120 | |
| 121 | function writeFramedMessage(child: ReturnType<typeof startServer>, payload: unknown) { |
| 122 | const input = child.stdin; |
| 123 | if (!input) throw new Error("stdin unavailable"); |
| 124 | const body = JSON.stringify(payload); |
| 125 | input.write(`Content-Length: ${Buffer.byteLength(body)}\r\n\r\n${body}`); |
| 126 | } |
| 127 | |
| 128 | function writeLineMessage(child: ReturnType<typeof startServer>, payload: unknown) { |
| 129 | const input = child.stdin; |