@@ -119,6 +119,8 @@ const { kTimeout } = require('internal/timers');
119
119
const DEFAULT_IPV4_ADDR = '0.0.0.0' ;
120
120
const DEFAULT_IPV6_ADDR = '::' ;
121
121
122
+ const isWindows = process . platform === 'win32' ;
123
+
122
124
function noop ( ) { }
123
125
124
126
function getFlags ( ipv6Only ) {
@@ -335,8 +337,7 @@ function Socket(options) {
335
337
this [ async_id_symbol ] = this . _handle . getAsyncId ( ) ;
336
338
337
339
if ( ( fd === 1 || fd === 2 ) &&
338
- ( this . _handle instanceof Pipe ) &&
339
- process . platform === 'win32' ) {
340
+ ( this . _handle instanceof Pipe ) && isWindows ) {
340
341
// Make stdout and stderr blocking on Windows
341
342
err = this . _handle . setBlocking ( true ) ;
342
343
if ( err )
@@ -1024,7 +1025,7 @@ function lookupAndConnect(self, options) {
1024
1025
hints : options . hints || 0
1025
1026
} ;
1026
1027
1027
- if ( process . platform !== 'win32' &&
1028
+ if ( ! isWindows &&
1028
1029
dnsopts . family !== 4 &&
1029
1030
dnsopts . family !== 6 &&
1030
1031
dnsopts . hints === 0 ) {
@@ -1227,7 +1228,7 @@ function createServerHandle(address, port, addressType, fd, flags) {
1227
1228
assert ( ! address && ! port ) ;
1228
1229
} else if ( port === - 1 && addressType === - 1 ) {
1229
1230
handle = new Pipe ( PipeConstants . SERVER ) ;
1230
- if ( process . platform === 'win32' ) {
1231
+ if ( isWindows ) {
1231
1232
const instances = parseInt ( process . env . NODE_PENDING_PIPE_INSTANCES ) ;
1232
1233
if ( ! NumberIsNaN ( instances ) ) {
1233
1234
handle . setPendingInstances ( instances ) ;
@@ -1710,7 +1711,7 @@ Server.prototype.unref = function() {
1710
1711
let _setSimultaneousAccepts ;
1711
1712
let warnSimultaneousAccepts = true ;
1712
1713
1713
- if ( process . platform === 'win32' ) {
1714
+ if ( isWindows ) {
1714
1715
let simultaneousAccepts ;
1715
1716
1716
1717
_setSimultaneousAccepts = function ( handle ) {
0 commit comments