Skip to content

stream: ensure writable.destroy() emits error once

Rodrigo Muino Tomonari requested to merge github/fork/lpinca/gh-26015 into master

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.

Fixes: https://github.com/nodejs/node/issues/26015 Refs: https://github.com/nodejs/node/pull/20745#discussion_r191537229

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines

Merge request reports

Loading