-
-
Notifications
You must be signed in to change notification settings - Fork 33.8k
stream: callback should be called when pendingcb is 0 #53438
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
Changes from 4 commits
02c7662
84580ed
b052a0c
39a5437
ce31bd0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -669,15 +669,21 @@ testClosed((opts) => new Writable({ write() {}, ...opts })); | |
| } | ||
|
|
||
| { | ||
| let isCalld = false; | ||
| const stream = new Duplex({ | ||
| write(chunk, enc, cb) { | ||
| setImmediate(cb); | ||
| setImmediate(() => { | ||
| isCalld = true; | ||
| cb(); | ||
| }); | ||
| } | ||
| }); | ||
|
|
||
| stream.end('foo'); | ||
|
|
||
| finished(stream, { readable: false }, common.mustCall((err) => { | ||
| assert(!err); | ||
| assert.strictEqual(isCalld, true); | ||
| assert.strictEqual(stream._writableState.pendingcb, 0); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add a test that does not look into _writableState? Why are you doing this change?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sure, I will add a new test to address it, thanks!
Do you mean the change to the test? If so, it is because when the callback function is called in
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I have expanded the test to make sure the cb in |
||
| })); | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.