doc: clarify pipeline stream cleanup

PR-URL: https://github.com/nodejs/node/pull/29738
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
This commit is contained in:
Robert Nagy authored and Michaël Zasso committed 2019-10-01 14:37:22 +02:00
1 parent ab060bfdab
commit 2ea4cc0732
1 file changed
+4
+4
View File
@@ -1587,6 +1587,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.