-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
net: prefer === to == #11513
net: prefer === to == #11513
Conversation
This is a serious breaking change |
ah, yes, good point. The |
Second thoughts... needs some tweaking to avoid the breaking change
Sorry to ask this, but can someone explain what exactly is the breakdown? It seems that I something misunderstood :( What the breaking case? |
lib/net.js
Outdated
@@ -146,7 +146,7 @@ function Socket(options) { | |||
} else if (options.fd !== undefined) { | |||
this._handle = createHandle(options.fd); | |||
this._handle.open(options.fd); | |||
if ((options.fd == 1 || options.fd == 2) && | |||
if ((options.fd === 1 || options.fd === 2) && |
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 I'm following the code correctly, this could conceivably be a breaking change for some. Since options.fd
can be provided by the end user, it may be a string. Before this change, passing in '1'
would have the same effect as 1
. But now it won't. It only affects whether stdout and stderr are blocking or not on Windows. ¯\(ツ)/¯ @nodejs/platform-windows
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.
Ah, got it. Thank you!
Hmm, and what are workarounds? ParseInt'ing? (looks like hack :( ) Leave it as is? (options.fd can be === true, thats not okay?)
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.
Well, you could just leave ==
. :-D
options.fd = +options.fd
should make it a number too. There are also bit-shifting things I think that might be more efficient.
But ultimately, I'm not sure this needs to be changed at all.
e59eaa4
to
89fa167
Compare
Reverted semver-major label now can be removed. Thanks to @vkurchatkin for pointing this out. |
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 with a nit.
lib/net.js
Outdated
@@ -146,6 +146,8 @@ function Socket(options) { | |||
} else if (options.fd !== undefined) { | |||
this._handle = createHandle(options.fd); | |||
this._handle.open(options.fd); | |||
// Non-strict equations here for legacy reasons. |
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.
Instead of saying this and linking to a GitHub issue, could you just explain the legacy reasons.
* Change === to == in one place * Add explanation about another non-strict if-statement
89fa167
to
9209efa
Compare
Expanded commit message; made comment on |
* Change === to == in one place * Add explanation about another non-strict if-statement PR-URL: #11513 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Landed in 84c448e |
* Change === to == in one place * Add explanation about another non-strict if-statement PR-URL: nodejs#11513 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
* Change === to == in one place * Add explanation about another non-strict if-statement PR-URL: #11513 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
* Change === to == in one place * Add explanation about another non-strict if-statement PR-URL: #11513 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
* Change === to == in one place * Add explanation about another non-strict if-statement PR-URL: #11513 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
* Change === to == in one place * Add explanation about another non-strict if-statement PR-URL: #11513 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)
net