From cd722e242a3a51360188e71b06b3db17d8fae26e Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 13 Dec 2018 09:11:13 -0500 Subject: [PATCH] net: use strict comparisons for fd This commit removes an eslint-disable comment, and moves file descriptor checks to use strict equality. These checks were using loose equality to support numeric and string file descriptors. However, d9e95d8982ee5b409b36f09c77feccbb1040095c introduced strict validation, making the loose equality checks redundant. PR-URL: https://github.com/nodejs/node/pull/25014 Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca Reviewed-By: Jeremiah Senkpiel Reviewed-By: Daijiro Wachi Reviewed-By: James M Snell --- lib/net.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/net.js b/lib/net.js index a9c940c6831f46..e40aaa870289e8 100644 --- a/lib/net.js +++ b/lib/net.js @@ -275,11 +275,8 @@ function Socket(options) { throw errnoException(err, 'open'); this[async_id_symbol] = this._handle.getAsyncId(); - // options.fd can be string (since it is user-defined), - // so changing this to === would be semver-major - // See: https://github.com/nodejs/node/pull/11513 - // eslint-disable-next-line eqeqeq - if ((fd == 1 || fd == 2) && + + if ((fd === 1 || fd === 2) && (this._handle instanceof Pipe) && process.platform === 'win32') { // Make stdout and stderr blocking on Windows