stream: pass error on legacy destroy#43519
Merged
nodejs-github-bot merged 2 commits intonodejs:mainfrom Jun 28, 2022
greguz:streams-legacy-error
Merged
stream: pass error on legacy destroy#43519nodejs-github-bot merged 2 commits intonodejs:mainfrom greguz:streams-legacy-error
nodejs-github-bot merged 2 commits intonodejs:mainfrom
greguz:streams-legacy-error
Conversation
Collaborator
|
Review requested:
|
Contributor
|
This needs a test |
ronag
approved these changes
Jun 21, 2022
lpinca
approved these changes
Jun 21, 2022
Contributor
Author
|
@mscdex I came out (about tests) with this:
{
// Mimics a legacy stream without the .destroy method
class LegacyWritable extends Stream {
write(chunk, encoding, callback) {
callback();
}
}
const writable = new LegacyWritable();
writable.on('error', common.mustCall((err) => {
assert.deepStrictEqual(err, new Error('stop'));
}));
pipeline(
Readable.from({
[Symbol.asyncIterator]() {
return {
next() {
return Promise.reject(new Error('stop'));
}
};
}
}),
writable,
common.mustCall((err) => {
assert.deepStrictEqual(err, new Error('stop'));
})
);
}I have to say that this is a very specific edge case. The only way to trigger the bug is to use either |
benjamingr
approved these changes
Jun 21, 2022
Member
benjamingr
left a comment
There was a problem hiding this comment.
The test looks fine (it's indeed an edge case but the test is needed to make sure we don't cause a regression in the future)
Collaborator
35 tasks
JungMinu
approved these changes
Jun 22, 2022
This was referenced Jun 23, 2022
jasnell
approved these changes
Jun 27, 2022
Collaborator
Collaborator
Collaborator
32 tasks
Collaborator
Collaborator
|
Landed in 51beb26 |
23 tasks
targos
pushed a commit
that referenced
this pull request
Jul 12, 2022
PR-URL: #43519 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Minwoo Jung <nodecorelab@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While looking at readable-stream source, I've found a possible missed argument while emitting an error toward legacy streams.
make lintpasses.make -j4 test(UNIX), orvcbuild test(Windows) passes.