[v8.x backport] stream: ensure writable.destroy() emits error once
Prevent the 'error'
event from being emitted multiple times if
writable.destroy()
is called with an error before the _destroy()
callback is called.
Emit the first error, discard all others.
PR-URL: https://github.com/nodejs/node/pull/26057 Fixes: https://github.com/nodejs/node/issues/26015 Reviewed-By: Matteo Collina matteo.collina@gmail.com Reviewed-By: Ruben Bridgewater ruben@bridgewater.de Reviewed-By: James M Snell jasnell@gmail.com
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines