Commit 31e841f0563 for nodejs

commit 31e841f05633513db165eeaa8f51986d6932f8ca
Author: Dayun <dlekdbs6530@gmail.com>
Date:   Sun Sep 27 04:32:45 2026 +0900

    stream: fix pipeline function tail deadlock

    Signed-off-by: Dayun <dlekdbs6530@gmail.com>
    PR-URL: https://github.com/nodejs/node/pull/65559
    Fixes: https://github.com/nodejs/node/issues/40685
    Reviewed-By: Robert Nagy <ronagy@icloud.com>
    Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
    Reviewed-By: James M Snell <jasnell@gmail.com>

diff --git a/lib/stream/promises.js b/lib/stream/promises.js
index a8b65d62b09..43c378a20f2 100644
--- a/lib/stream/promises.js
+++ b/lib/stream/promises.js
@@ -1,6 +1,7 @@
 'use strict';

 const {
+  ArrayIsArray,
   ArrayPrototypePop,
   Promise,
 } = primordials;
@@ -28,13 +29,22 @@ function pipeline(...streams) {
       end = options.end;
     }

-    pl(streams, (err, value) => {
+    let lastStream = streams[streams.length - 1];
+    if (streams.length === 1 && ArrayIsArray(streams[0])) {
+      lastStream = streams[0][streams[0].length - 1];
+    }
+
+    const stream = pl(streams, (err, value) => {
       if (err) {
         reject(err);
       } else {
         resolve(value);
       }
     }, { signal, end });
+
+    if (typeof lastStream === 'function' && stream.readable) {
+      stream.resume();
+    }
   });
 }

diff --git a/test/parallel/test-stream-pipeline.js b/test/parallel/test-stream-pipeline.js
index 65fb30d95c8..b87e2ebeb3a 100644
--- a/test/parallel/test-stream-pipeline.js
+++ b/test/parallel/test-stream-pipeline.js
@@ -1657,6 +1657,22 @@ tmpdir.refresh();
   }));
 }

+{
+  async function* passThrough(source) {
+    for await (const chunk of source) {
+      yield chunk;
+    }
+  }
+
+  const streams = () => [
+    Readable.from(Array.from({ length: 100 }, (_, i) => i)),
+    passThrough,
+  ];
+
+  pipelinep(...streams()).then(common.mustCall());
+  pipelinep(streams()).then(common.mustCall());
+}
+
 {
   const r = new Readable();
   for (let i = 0; i < 4000; i++) {