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 2019-09-27 22:32:54 +02:00 committed by Rich Trott
parent 663ef98e9a
commit 1a3bf4f935

View File

@ -1590,6 +1590,10 @@ async function run() {
run().catch(console.error); 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 `stream.pipeline()` leaves dangling event listeners on the streams
after the `callback` has been invoked. In the case of reuse of streams after after the `callback` has been invoked. In the case of reuse of streams after
failure, this can cause event listener leaks and swallowed errors. failure, this can cause event listener leaks and swallowed errors.