diff options
author | Debadree Chatterjee <debadree333@gmail.com> | 2023-04-27 13:14:39 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 07:44:39 +0000 |
commit | f34a07d3a78fe34e6221c42721ae3f2f6a3d8cf0 (patch) | |
tree | 5d9dc30199363c918d09e2a2cb81c8e8fd76ae4e /lib | |
parent | b6738c1af040505bcb241b8740eb91e81c15eb44 (diff) | |
download | node-new-f34a07d3a78fe34e6221c42721ae3f2f6a3d8cf0.tar.gz |
stream: prevent pipeline hang with generator functions
Fixes: https://github.com/nodejs/node/issues/47708
PR-URL: https://github.com/nodejs/node/pull/47712
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Feng Yu <F3n67u@outlook.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/internal/streams/pipeline.js | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/internal/streams/pipeline.js b/lib/internal/streams/pipeline.js index 95737d95e4..062bdc192d 100644 --- a/lib/internal/streams/pipeline.js +++ b/lib/internal/streams/pipeline.js @@ -138,10 +138,9 @@ async function pumpToNode(iterable, writable, finish, { end }) { if (end) { writable.end(); + await wait(); } - await wait(); - finish(); } catch (err) { finish(error !== err ? aggregateTwoErrors(error, err) : err); |