-
-
Notifications
You must be signed in to change notification settings - Fork 34.2k
stream: allow readable to end early without error #40881
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 1 commit
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -1027,7 +1027,7 @@ const tsp = require('timers/promises'); | |||||
| const src = new PassThrough(); | ||||||
| const dst = new PassThrough(); | ||||||
| pipeline(src, dst, common.mustSucceed(() => { | ||||||
| assert.strictEqual(dst.destroyed, true); | ||||||
| assert.strictEqual(dst.destroyed, false); | ||||||
| })); | ||||||
| src.end(); | ||||||
| } | ||||||
|
|
@@ -1462,7 +1462,7 @@ const tsp = require('timers/promises'); | |||||
|
|
||||||
| await pipelinePromise(read, duplex); | ||||||
|
|
||||||
| assert.strictEqual(duplex.destroyed, true); | ||||||
| assert.strictEqual(duplex.destroyed, false); | ||||||
| } | ||||||
|
|
||||||
| run().then(common.mustCall()); | ||||||
|
|
@@ -1488,3 +1488,27 @@ const tsp = require('timers/promises'); | |||||
|
|
||||||
| run().then(common.mustCall()); | ||||||
| } | ||||||
|
|
||||||
| { | ||||||
| const s = new PassThrough({ objectMode: true }); | ||||||
| pipeline(async function*() { | ||||||
| await Promise.resolve(); | ||||||
| yield 'hello'; | ||||||
| yield 'world'; | ||||||
| yield 'world'; | ||||||
| }, s, async function(source) { | ||||||
| let ret = ''; | ||||||
| let n = 0; | ||||||
| for await (const chunk of source) { | ||||||
| if (n++ > 1) { | ||||||
| return; | ||||||
| } | ||||||
| ret += chunk; | ||||||
| } | ||||||
| return ret; | ||||||
| }, common.mustCall((err, val) => { | ||||||
| assert.strictEqual(err, undefined); | ||||||
| assert.strictEqual(val, 'helloworld'); | ||||||
|
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. This test seems to be broken.
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. Yea.. that's weird. Fixed the test.
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. Updated test looks good, but why the process did not exit?
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. I can reproduce the same issue with current Node.js version (v17.2.0) so it is not related to this PR but it is something to investigate and fix.
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. It seems that the error thrown in the callback is caught and swallowed here node/lib/internal/streams/pipeline.js Lines 163 to 164 in 147d23b
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. Fixed, PTAL, f0ec29b |
||||||
| assert.strictEqual(s.destroyed, true); | ||||||
| })); | ||||||
| } | ||||||
Uh oh!
There was an error while loading. Please reload this page.