Skip to content
Permalink
Browse files

doc: clarify pipeline stream cleanup

PR-URL: #29738
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information...
ronag authored and Trott committed Sep 27, 2019
1 parent 663ef98 commit 1a3bf4f935f097cd2072fc383518fac873322a68
Showing with 4 additions and 0 deletions.
  1. +4 −0 doc/api/stream.md
@@ -1590,6 +1590,10 @@ async function run() {
run().catch(console.error);
```

`stream.pipeline()` will call `stream.destroy(err)` on all streams except:
* `Readable` streams which have emitted `'end'` or `'close'`.
* `Writable` streams which have emitted `'finish'` or `'close'`.

`stream.pipeline()` leaves dangling event listeners on the streams
after the `callback` has been invoked. In the case of reuse of streams after
failure, this can cause event listener leaks and swallowed errors.

0 comments on commit 1a3bf4f

Please sign in to comment.
You can’t perform that action at this time.