test,stream: fix pipeline test so it runs well on Windows in older nodes
This test is ported automatically in readable-stream, and it fails there on Windows and older Node.js versions because of some bad interactions between the code and the event loop on Windows. See: https://github.com/nodejs/readable-stream/issues/353 PR-URL: https://github.com/nodejs/node/pull/22456 Reviewed-By: Mathias Buus <mathiasbuus@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
57d98bc732
commit
656da16e1c
@ -165,8 +165,13 @@ const { promisify } = require('util');
|
|||||||
|
|
||||||
{
|
{
|
||||||
const server = http.createServer((req, res) => {
|
const server = http.createServer((req, res) => {
|
||||||
|
let sent = false;
|
||||||
const rs = new Readable({
|
const rs = new Readable({
|
||||||
read() {
|
read() {
|
||||||
|
if (sent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
sent = true;
|
||||||
rs.push('hello');
|
rs.push('hello');
|
||||||
},
|
},
|
||||||
destroy: common.mustCall((err, cb) => {
|
destroy: common.mustCall((err, cb) => {
|
||||||
@ -195,8 +200,12 @@ const { promisify } = require('util');
|
|||||||
|
|
||||||
{
|
{
|
||||||
const server = http.createServer((req, res) => {
|
const server = http.createServer((req, res) => {
|
||||||
|
let sent = 0;
|
||||||
const rs = new Readable({
|
const rs = new Readable({
|
||||||
read() {
|
read() {
|
||||||
|
if (sent++ > 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rs.push('hello');
|
rs.push('hello');
|
||||||
},
|
},
|
||||||
destroy: common.mustCall((err, cb) => {
|
destroy: common.mustCall((err, cb) => {
|
||||||
@ -242,8 +251,12 @@ const { promisify } = require('util');
|
|||||||
port: server.address().port
|
port: server.address().port
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let sent = 0;
|
||||||
const rs = new Readable({
|
const rs = new Readable({
|
||||||
read() {
|
read() {
|
||||||
|
if (sent++ > 10) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
rs.push('hello');
|
rs.push('hello');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user