From bf42467e215b20b36ec6b4bf30212e4beb2dd01f Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Thu, 23 Nov 2023 09:57:05 +0900 Subject: fix(ext/node): fix node:stream.Writable (#21297) This change applies the same fix as https://github.com/nodejs/node/pull/46818, and the original example given in #20456 works as expected. closes #20456 --- ext/node/polyfills/_stream.mjs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'ext/node') diff --git a/ext/node/polyfills/_stream.mjs b/ext/node/polyfills/_stream.mjs index 26d5fd30a..23df11ab3 100644 --- a/ext/node/polyfills/_stream.mjs +++ b/ext/node/polyfills/_stream.mjs @@ -1669,9 +1669,11 @@ var require_destroy = __commonJS({ } } try { - stream._construct(onConstruct); + stream._construct((err) => { + nextTick(onConstruct, err); + }); } catch (err) { - onConstruct(err); + nextTick(onConstruct, err); } } function emitConstructNT(stream) { -- cgit v1.2.3