(private readonly channel: MessageSender)
| 47 | }; |
| 48 | |
| 49 | constructor(private readonly channel: MessageSender) { |
| 50 | this.state = 'running'; |
| 51 | this.stdout = new Emitter(); |
| 52 | this.stderr = new Emitter(); |
| 53 | this.stdin = { |
| 54 | write: (data: string | Uint8Array): Promise<void> => { |
| 55 | if (!this.id) { |
| 56 | throw new Error('Failed to write to stdin, no process is currently running'); |
| 57 | } |
| 58 | |
| 59 | return this.channel.send('shell/stdin', { data: data, workerId: this.id }); |
| 60 | }, |
| 61 | }; |
| 62 | |
| 63 | this.forwardStdEvents(); |
| 64 | } |
| 65 | |
| 66 | private forwardStdEvents(): void { |
| 67 | this.channel.on('worker/tty', (message) => { |
nothing calls this directly
no test coverage detected