-
Notifications
You must be signed in to change notification settings - Fork 30.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
stream: don't destroy final readable stream in pipeline #32110
Conversation
3d9f49b
to
9cb4046
Compare
This comment has been minimized.
This comment has been minimized.
If the last stream in a pipeline is still usable/readable don't destroy it to allow further composition. Fixes: nodejs#32105
9cb4046
to
5fefa4f
Compare
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
@nodejs/streams |
CI LGTM (not signing off as I am not familliar with codebase). If no one else wants to volunteer I can help get this out in a release next week |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good for composition. Might be surprising in some cases - e.g. when the user isn't aware that their last stream is a duplex, for example with gulp.dest()
- so should be documented later on.
Why is it a I agree some documentation might be in order. |
@ronag Many gulp examples suggest that const vfs = require('vinyl-fs') // or gulp
const { pipeline } = require('stream')
const src = vfs.src('./index.js')
const dest = vfs.dest('./dest')
pipeline(src, dest, function (err) {
if (err) throw err
}) And following that, you'd expect const src = vfs.src('./index.js')
const dest1 = vfs.dest('./dest1')
const dest2 = vfs.dest('./dest2')
pipeline(src, dest1, dest2, function (err) {
if (err) throw err
assert.strictEqual(dest2.readable, true)
}) |
I don't understand what that last example is supposed to do? Will |
Yes, they are duplex streams that pass through their input. In a nutshell, the snippet above copies I can't think of cases other than gulp though and I consider the above to be a flaw in its API design rather than a problem that node streams should address. |
I wanted to suggest a CITGM, which includes |
@vweevers You are a member of nodejs/streams but GitHub doesn't count your approval? How come? |
I don't have write access to this repo. @mcollina invited me to the streams wg in relation to |
You are welcome to chime in here @vweevers! |
Landed in 4d93e10 |
If the last stream in a pipeline is still usable/readable
don't destroy it to allow further composition.
Fixes: #32105
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passes