(port, name)
| 249 | |
| 250 | class ReadableWorkerStdio extends Readable { |
| 251 | constructor(port, name) { |
| 252 | super(); |
| 253 | this[kPort] = port; |
| 254 | this[kName] = name; |
| 255 | this[kIncrementsPortRef] = true; |
| 256 | this[kStartedReading] = false; |
| 257 | this.on('end', () => { |
| 258 | if (this[kStartedReading] && this[kIncrementsPortRef]) { |
| 259 | if (--this[kPort][kWaitingStreams] === 0) |
| 260 | this[kPort].unref(); |
| 261 | } |
| 262 | }); |
| 263 | } |
| 264 | |
| 265 | _read() { |
| 266 | if (!this[kStartedReading] && this[kIncrementsPortRef]) { |