Uh oh!
There was an error while loading. Please reload this page.
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.
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.
So … the code above (https://github.com/nodejs/node/pull/22892/files#diff-f45eb699237c2e38dc9b49b588933c11R923) reads like
stdiocould be:handleproperty which is a native stream handle_handleproperty which is a native stream handleThe path that is typically taken for e.g.
net.Sockets would be the third one, I think. We should probably look into deprecating at least the first two, but … all that’s a different story and not really for this PR.What matters is that
stdiodoes not need to be any kind of particular object; most of the time, it’s anet.Socketor similar, but it could also just be{ handle: someNativeHandle }. Even though that’s a bad idea imo, the code above points to this being a possibility. This means that thestream._stdio.emit()call above might fail, becauseemit()might not be available?I guess a simple solution would be to turn the
if (stream._stdio) {conditional intoif (stream._stdio && typeof stream._stdio.emit === 'function') {?Uh oh!
There was an error while loading. Please reload this page.
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 see. I will fix other PR.
I came up with a way when object is pushed. How about this?
Should it be judged when
emit()?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.
Or how about
if (stream._stdio instanceof EventEmitter)?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.
@koh110 I’m not sure.
instanceof EventEmitteris probably fine, too?I would prefer for the
_stdioproperty to be present consistently, though – either it’s always there or always missing.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.
@addaleax Yeah, you right. I completely agree. I was wrong.
I feel that
if (stream._stdio && stream._stdio instanceof EventEmitter) {is more meaningful thanif(stream._stdio && typeof stream._stdio.emit === 'function') {.EventEmittermay be changed toWritableStream. What do you think about it?