@@ -105,8 +105,8 @@ const handleConversion = {
105
105
// The worker should keep track of the socket
106
106
message . key = socket . server . _connectionKey ;
107
107
108
- var firstTime = ! this . channel . sockets . send [ message . key ] ;
109
- var socketList = getSocketList ( 'send' , this , message . key ) ;
108
+ const firstTime = ! this . channel . sockets . send [ message . key ] ;
109
+ const socketList = getSocketList ( 'send' , this , message . key ) ;
110
110
111
111
// The server should no longer expose a .connection property
112
112
// and when asked to close it should query the socket status from
@@ -173,7 +173,7 @@ const handleConversion = {
173
173
if ( message . key ) {
174
174
175
175
// Add socket to connections list
176
- var socketList = getSocketList ( 'got' , this , message . key ) ;
176
+ const socketList = getSocketList ( 'got' , this , message . key ) ;
177
177
socketList . add ( {
178
178
socket : socket
179
179
} ) ;
@@ -260,7 +260,7 @@ function ChildProcess() {
260
260
this . _handle = null ;
261
261
262
262
if ( exitCode < 0 ) {
263
- var syscall = this . spawnfile ? 'spawn ' + this . spawnfile : 'spawn' ;
263
+ const syscall = this . spawnfile ? 'spawn ' + this . spawnfile : 'spawn' ;
264
264
const err = errnoException ( exitCode , syscall ) ;
265
265
266
266
if ( this . spawnfile )
@@ -292,7 +292,7 @@ function flushStdio(subprocess) {
292
292
293
293
if ( stdio == null ) return ;
294
294
295
- for ( var i = 0 ; i < stdio . length ; i ++ ) {
295
+ for ( let i = 0 ; i < stdio . length ; i ++ ) {
296
296
const stream = stdio [ i ] ;
297
297
// TODO(addaleax): This doesn't necessarily account for all the ways in
298
298
// which data can be read from a stream, e.g. being consumed on the
@@ -463,7 +463,7 @@ ChildProcess.prototype.kill = function(sig) {
463
463
convertToValidSignal ( sig === undefined ? 'SIGTERM' : sig ) ;
464
464
465
465
if ( this . _handle ) {
466
- var err = this . _handle . kill ( signal ) ;
466
+ const err = this . _handle . kill ( signal ) ;
467
467
if ( err === 0 ) {
468
468
/* Success. */
469
469
this . killed = true ;
@@ -608,7 +608,7 @@ function setupChannel(target, channel) {
608
608
}
609
609
610
610
assert ( Array . isArray ( target . _handleQueue ) ) ;
611
- var queue = target . _handleQueue ;
611
+ const queue = target . _handleQueue ;
612
612
target . _handleQueue = null ;
613
613
614
614
if ( target . _pendingMessage ) {
@@ -618,8 +618,8 @@ function setupChannel(target, channel) {
618
618
target . _pendingMessage . callback ) ;
619
619
}
620
620
621
- for ( var i = 0 ; i < queue . length ; i ++ ) {
622
- var args = queue [ i ] ;
621
+ for ( let i = 0 ; i < queue . length ; i ++ ) {
622
+ const args = queue [ i ] ;
623
623
target . _send ( args . message , args . handle , args . options , args . callback ) ;
624
624
}
625
625
@@ -852,7 +852,7 @@ function setupChannel(target, channel) {
852
852
if ( this . _pendingMessage )
853
853
closePendingHandle ( this ) ;
854
854
855
- var fired = false ;
855
+ let fired = false ;
856
856
function finish ( ) {
857
857
if ( fired ) return ;
858
858
fired = true ;
@@ -901,8 +901,8 @@ function isInternal(message) {
901
901
function nop ( ) { }
902
902
903
903
function getValidStdio ( stdio , sync ) {
904
- var ipc ;
905
- var ipcFd ;
904
+ let ipc ;
905
+ let ipcFd ;
906
906
907
907
// Replace shortcut with an array
908
908
if ( typeof stdio === 'string' ) {
@@ -921,7 +921,7 @@ function getValidStdio(stdio, sync) {
921
921
// (i.e. PipeWraps or fds)
922
922
stdio = stdio . reduce ( ( acc , stdio , i ) => {
923
923
function cleanup ( ) {
924
- for ( var i = 0 ; i < acc . length ; i ++ ) {
924
+ for ( let i = 0 ; i < acc . length ; i ++ ) {
925
925
if ( ( acc [ i ] . type === 'pipe' || acc [ i ] . type === 'ipc' ) && acc [ i ] . handle )
926
926
acc [ i ] . handle . close ( ) ;
927
927
}
@@ -935,7 +935,7 @@ function getValidStdio(stdio, sync) {
935
935
if ( stdio === 'ignore' ) {
936
936
acc . push ( { type : 'ignore' } ) ;
937
937
} else if ( stdio === 'pipe' || ( typeof stdio === 'number' && stdio < 0 ) ) {
938
- var a = {
938
+ const a = {
939
939
type : 'pipe' ,
940
940
readable : i === 0 ,
941
941
writable : i !== 0
@@ -975,7 +975,7 @@ function getValidStdio(stdio, sync) {
975
975
} ) ;
976
976
} else if ( getHandleWrapType ( stdio ) || getHandleWrapType ( stdio . handle ) ||
977
977
getHandleWrapType ( stdio . _handle ) ) {
978
- var handle = getHandleWrapType ( stdio ) ?
978
+ const handle = getHandleWrapType ( stdio ) ?
979
979
stdio :
980
980
getHandleWrapType ( stdio . handle ) ? stdio . handle : stdio . _handle ;
981
981
@@ -1005,9 +1005,9 @@ function getValidStdio(stdio, sync) {
1005
1005
1006
1006
function getSocketList ( type , worker , key ) {
1007
1007
const sockets = worker . channel . sockets [ type ] ;
1008
- var socketList = sockets [ key ] ;
1008
+ let socketList = sockets [ key ] ;
1009
1009
if ( ! socketList ) {
1010
- var Construct = type === 'send' ? SocketListSend : SocketListReceive ;
1010
+ const Construct = type === 'send' ? SocketListSend : SocketListReceive ;
1011
1011
socketList = sockets [ key ] = new Construct ( worker , key ) ;
1012
1012
}
1013
1013
return socketList ;
@@ -1027,7 +1027,7 @@ function spawnSync(opts) {
1027
1027
const result = spawn_sync . spawn ( options ) ;
1028
1028
1029
1029
if ( result . output && options . encoding && options . encoding !== 'buffer' ) {
1030
- for ( var i = 0 ; i < result . output . length ; i ++ ) {
1030
+ for ( let i = 0 ; i < result . output . length ; i ++ ) {
1031
1031
if ( ! result . output [ i ] )
1032
1032
continue ;
1033
1033
result . output [ i ] = result . output [ i ] . toString ( options . encoding ) ;
0 commit comments