-
Notifications
You must be signed in to change notification settings - Fork 28.2k
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: support dispose in writable #48547
base: main
Are you sure you want to change the base?
Conversation
Review requested:
|
Add support to Symbol.asyncDispose in writable streams. Additionally add a test for writable, transform and duplex streams who inherit from readable/writable to avoid breakage.
f38134b
to
63aad0a
Compare
This comment was marked as outdated.
This comment was marked as outdated.
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
This comment was marked as outdated.
This comment was marked as outdated.
Co-authored-by: Robert Nagy <ronagy@icloud.com>
}); | ||
let count = 0; | ||
duplex.on('error', common.mustCall((e) => { | ||
assert.strictEqual(count++, 0); // Ensure not called twice |
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.
common.mustCall
accepts a count argument: common.mustCall(fn, times)
Co-authored-by: Robert Nagy <ronagy@icloud.com>
This needs a rebase. |
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
error = this.writableFinished ? null : new AbortError(); | ||
this.destroy(error); | ||
} | ||
return new Promise((resolve, reject) => eos(this, (err) => (err && err.name !== 'AbortError ? reject(err) : resolve(null)))); |
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.
return new Promise((resolve, reject) => eos(this, (err) => (err && err.name !== 'AbortError ? reject(err) : resolve(null)))); | |
return new Promise((resolve, reject) => eos(this, (err) => (err && err.name !== 'AbortError' ? reject(err) : resolve(null)))); |
Add support to
Symbol.asyncDispose
in writable streams. Additionally add a test for writable, transform and duplex streams (that inherit from readable/writable) to avoid breakage.cc @nodejs/streams @MoLow @atlowChemi