(stream: ReadableStream<ExecEvent>)
| 32 | } |
| 33 | |
| 34 | async function drain(stream: ReadableStream<ExecEvent>): Promise<ExecEvent[]> { |
| 35 | const events: ExecEvent[] = []; |
| 36 | const reader = stream.getReader(); |
| 37 | try { |
| 38 | while (true) { |
| 39 | const { value, done } = await reader.read(); |
| 40 | if (done) break; |
| 41 | events.push(value); |
| 42 | } |
| 43 | } finally { |
| 44 | reader.releaseLock(); |
| 45 | } |
| 46 | return events; |
| 47 | } |
| 48 | |
| 49 | function decode(value: Uint8Array): string { |
| 50 | return new TextDecoder().decode(value); |
no test coverage detected