Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 256289f

Browse filesBrowse files
ronagMylesBorins
authored andcommitted
stream: sync stream unpipe resume
pipe() ondata should not control flow state if cleaned up. Fixes: #31190 PR-URL: #31191 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent f62fb76 commit 256289f
Copy full SHA for 256289f

File tree

Expand file treeCollapse file tree

2 files changed

+21
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+21
-1
lines changed
Open diff view settings
Collapse file

‎lib/_stream_readable.js‎

Copy file name to clipboardExpand all lines: lib/_stream_readable.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -740,6 +740,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
740740
debug('false write response, pause', state.awaitDrainWriters.size);
741741
state.awaitDrainWriters.add(dest);
742742
}
743+
src.pause();
743744
}
744745
if (!ondrain) {
745746
// When the dest drains, it reduces the awaitDrain counter
@@ -749,7 +750,6 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
749750
ondrain = pipeOnDrain(src, dest);
750751
dest.on('drain', ondrain);
751752
}
752-
src.pause();
753753
}
754754
}
755755

Collapse file
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
'use strict';
2+
3+
const common = require('../common');
4+
const stream = require('stream');
5+
const fs = require('fs');
6+
7+
const readStream = fs.createReadStream(process.execPath);
8+
9+
const transformStream = new stream.Transform({
10+
transform: common.mustCall(() => {
11+
readStream.unpipe();
12+
readStream.resume();
13+
})
14+
});
15+
16+
readStream.on('end', common.mustCall());
17+
18+
readStream
19+
.pipe(transformStream)
20+
.resume();

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.