(data: string | Buffer, opts?: { binary?: boolean }, cb?: (err?: Error) => void)
| 45 | } |
| 46 | |
| 47 | send(data: string | Buffer, opts?: { binary?: boolean }, cb?: (err?: Error) => void): void { |
| 48 | if (!process.send || this.readyState !== this.OPEN) { |
| 49 | cb?.(new Error('IPC PTY socket is closed')) |
| 50 | return |
| 51 | } |
| 52 | const binary = opts?.binary ?? Buffer.isBuffer(data) |
| 53 | process.send({ type: MSG_SERVER, connectionId: this.connectionId, binary, data }, (err) => cb?.(err ?? undefined)) |
| 54 | } |
| 55 | |
| 56 | close(code = 1000, reason = ''): void { |
| 57 | if (this.readyState !== this.OPEN) return |