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.
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
stdio: implement manual start for ReadStream #36277
stdio: implement manual start for ReadStream #36277
Changes from all commits
57f65f2
33c1786
5cd8cb6
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This needs some tests that are specific to streams. How is a user of Stream be able to use this?
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.
@mcollina @joyeecheung @ronag @mscdex
Attaching a
data
handler will start the stream.I simply recreated the semantics of the non-documented option in
net.Socket
- which is what the thread bootstrap code uses.Its only user at the moment is this thread bootstrap code for the
stdin
stream. Thenet.Socket
option has a second use case inTLSWrap
- but I am not sure if it actually works - because this wouldn't happen : #35475The reason I did in
Readable
is simply that the reading is started from here for allReadable
exceptnet.Socket
which has its own startup codeTo move this to
ReadStream
I would need to reimplement part of this code and it will be a much more invasive changeSo two options:
manualStart
options as hidden non-documented options, eventually replacing them withSymbol
namesIt is also worth noting that there are two other
net.Socket
specific options, both non-documented,pauseOnStart
andpauseOnConnect
- which have different semantics - the bootstrap code being made formanualStart
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.
why are you using
fs.promises
? Could you please usefs
?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.
Because a cook who doesn't eat its own food is not a good cook 😄
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.
This test
fs.ReadStream
, notstream.Readable
. While this test is correct, can you please use one that just usestream.Readable
?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.
A
Readable
always starts in paused mode, this change affects only aReadStream
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.
How is that relevant? It behaves the same as ReadStream. The same test should apply.
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.
If that was true, you'd not need to modify
Readable
.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.
Maybe there is some biggus problem, how do you think?
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.
Likely, but it's possible to add an independent test.
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.
I'm confused what the problem here is? We just need change ReadStream to Readable. What is the "biggus" problem?
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.
this should be a setImmediate.
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.
The read handler is already in a
setImmediate
- so this will run the assert before Node has a chance to start reading data.I don't have any ideas on how to achieve this without a timer.
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.
thanks for the clarification. Maybe add this in a comment?
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.
his should be a setImmediate