Skip to content

Commit 8244efb

Browse files
addaleaxMyles Borins
authored and
Myles Borins
committed
streams: fix regression in unpipe()
Since 2e568d9 there is a bug where unpiping a stream from a readable stream that has `_readableState.pipesCount > 1` will cause it to remove the first stream in the `_.readableState.pipes` array no matter where in the list the `dest` stream was. This patch corrects that problem. PR-URL: #9171 Fixes: #9170 Reviewed-By: Evan Lucas <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Myles Borins <[email protected]>
1 parent 3518372 commit 8244efb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/_stream_readable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -671,7 +671,7 @@ Readable.prototype.unpipe = function(dest) {
671671
if (index === -1)
672672
return this;
673673

674-
state.pipes.splice(i, 1);
674+
state.pipes.splice(index, 1);
675675
state.pipesCount -= 1;
676676
if (state.pipesCount === 1)
677677
state.pipes = state.pipes[0];

0 commit comments

Comments
 (0)