From 2670c1d580320ed01d3a7add27bc5db2a23ac80b Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Mon, 8 Apr 2024 12:47:34 +0900 Subject: fix(ext/node): out-of-order writes of fs.createWriteStream (#23244) This PR follows this fix (https://github.com/nodejs/node/pull/52005) in Node.js. Stream's construct callback happens one tick earlier by this change, and it prevents the reordering of the first few chunks in `node:stream.Writable` closes #20284 --- ext/node/polyfills/_stream.mjs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'ext') diff --git a/ext/node/polyfills/_stream.mjs b/ext/node/polyfills/_stream.mjs index 6b772ac04..591f8bb51 100644 --- a/ext/node/polyfills/_stream.mjs +++ b/ext/node/polyfills/_stream.mjs @@ -1665,7 +1665,7 @@ var require_destroy = __commonJS({ } else if (err) { errorOrDestroy(stream, err, true); } else { - process.nextTick(emitConstructNT, stream); + stream.emit(kConstruct); } } try { @@ -1676,9 +1676,6 @@ var require_destroy = __commonJS({ nextTick(onConstruct, err); } } - function emitConstructNT(stream) { - stream.emit(kConstruct); - } function isRequest(stream) { return stream && stream.setHeader && typeof stream.abort === "function"; } -- cgit v1.2.3