mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
538d8ce106
closed promise is subscribed to first so will be resolved first, before any read promise. This causes data after EOF error to be thrown. Remove the push null from the closed promise handler. The push null gets done from the read handler when it detects done. PR-URL: https://github.com/nodejs/node/pull/45026 Fixes: https://github.com/nodejs/node/issues/42694 Reviewed-By: Daeyeon Jeong <daeyeon.dev@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
27 lines
600 B
JavaScript
27 lines
600 B
JavaScript
'use strict';
|
|
const { mustCall } = require('../common');
|
|
const { Readable, Duplex } = require('stream');
|
|
const { strictEqual } = require('assert');
|
|
|
|
function start(controller) {
|
|
controller.enqueue(new Uint8Array(1));
|
|
controller.close();
|
|
}
|
|
|
|
Readable.fromWeb(new ReadableStream({ start }))
|
|
.on('data', mustCall((d) => {
|
|
strictEqual(d.length, 1);
|
|
}))
|
|
.on('end', mustCall())
|
|
.resume();
|
|
|
|
Duplex.fromWeb({
|
|
readable: new ReadableStream({ start }),
|
|
writable: new WritableStream({ write(chunk) {} })
|
|
})
|
|
.on('data', mustCall((d) => {
|
|
strictEqual(d.length, 1);
|
|
}))
|
|
.on('end', mustCall())
|
|
.resume();
|