summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDebadree Chatterjee <debadree333@gmail.com>2023-04-27 13:14:39 +0530
committerGitHub <noreply@github.com>2023-04-27 07:44:39 +0000
commitf34a07d3a78fe34e6221c42721ae3f2f6a3d8cf0 (patch)
tree5d9dc30199363c918d09e2a2cb81c8e8fd76ae4e /lib
parentb6738c1af040505bcb241b8740eb91e81c15eb44 (diff)
downloadnode-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.js3
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);