@@ -103,8 +103,8 @@ const handleConversion = {
103
103
// The worker should keep track of the socket
104
104
message . key = socket . server . _connectionKey ;
105
105
106
- var firstTime = ! this . channel . sockets . send [ message . key ] ;
107
- var socketList = getSocketList ( 'send' , this , message . key ) ;
106
+ const firstTime = ! this . channel . sockets . send [ message . key ] ;
107
+ const socketList = getSocketList ( 'send' , this , message . key ) ;
108
108
109
109
// The server should no longer expose a .connection property
110
110
// and when asked to close it should query the socket status from
@@ -171,7 +171,7 @@ const handleConversion = {
171
171
if ( message . key ) {
172
172
173
173
// Add socket to connections list
174
- var socketList = getSocketList ( 'got' , this , message . key ) ;
174
+ const socketList = getSocketList ( 'got' , this , message . key ) ;
175
175
socketList . add ( {
176
176
socket : socket
177
177
} ) ;
@@ -258,7 +258,7 @@ function ChildProcess() {
258
258
this . _handle = null ;
259
259
260
260
if ( exitCode < 0 ) {
261
- var syscall = this . spawnfile ? 'spawn ' + this . spawnfile : 'spawn' ;
261
+ const syscall = this . spawnfile ? 'spawn ' + this . spawnfile : 'spawn' ;
262
262
const err = errnoException ( exitCode , syscall ) ;
263
263
264
264
if ( this . spawnfile )
@@ -290,7 +290,7 @@ function flushStdio(subprocess) {
290
290
291
291
if ( stdio == null ) return ;
292
292
293
- for ( var i = 0 ; i < stdio . length ; i ++ ) {
293
+ for ( let i = 0 ; i < stdio . length ; i ++ ) {
294
294
const stream = stdio [ i ] ;
295
295
// TODO(addaleax): This doesn't necessarily account for all the ways in
296
296
// which data can be read from a stream, e.g. being consumed on the
@@ -471,7 +471,7 @@ ChildProcess.prototype.kill = function(sig) {
471
471
convertToValidSignal ( sig === undefined ? 'SIGTERM' : sig ) ;
472
472
473
473
if ( this . _handle ) {
474
- var err = this . _handle . kill ( signal ) ;
474
+ const err = this . _handle . kill ( signal ) ;
475
475
if ( err === 0 ) {
476
476
/* Success. */
477
477
this . killed = true ;
@@ -611,7 +611,7 @@ function setupChannel(target, channel, serializationMode) {
611
611
}
612
612
613
613
assert ( Array . isArray ( target . _handleQueue ) ) ;
614
- var queue = target . _handleQueue ;
614
+ const queue = target . _handleQueue ;
615
615
target . _handleQueue = null ;
616
616
617
617
if ( target . _pendingMessage ) {
@@ -621,8 +621,8 @@ function setupChannel(target, channel, serializationMode) {
621
621
target . _pendingMessage . callback ) ;
622
622
}
623
623
624
- for ( var i = 0 ; i < queue . length ; i ++ ) {
625
- var args = queue [ i ] ;
624
+ for ( let i = 0 ; i < queue . length ; i ++ ) {
625
+ const args = queue [ i ] ;
626
626
target . _send ( args . message , args . handle , args . options , args . callback ) ;
627
627
}
628
628
@@ -854,7 +854,7 @@ function setupChannel(target, channel, serializationMode) {
854
854
if ( this . _pendingMessage )
855
855
closePendingHandle ( this ) ;
856
856
857
- var fired = false ;
857
+ let fired = false ;
858
858
function finish ( ) {
859
859
if ( fired ) return ;
860
860
fired = true ;
@@ -903,8 +903,8 @@ function isInternal(message) {
903
903
function nop ( ) { }
904
904
905
905
function getValidStdio ( stdio , sync ) {
906
- var ipc ;
907
- var ipcFd ;
906
+ let ipc ;
907
+ let ipcFd ;
908
908
909
909
// Replace shortcut with an array
910
910
if ( typeof stdio === 'string' ) {
@@ -923,7 +923,7 @@ function getValidStdio(stdio, sync) {
923
923
// (i.e. PipeWraps or fds)
924
924
stdio = stdio . reduce ( ( acc , stdio , i ) => {
925
925
function cleanup ( ) {
926
- for ( var i = 0 ; i < acc . length ; i ++ ) {
926
+ for ( let i = 0 ; i < acc . length ; i ++ ) {
927
927
if ( ( acc [ i ] . type === 'pipe' || acc [ i ] . type === 'ipc' ) && acc [ i ] . handle )
928
928
acc [ i ] . handle . close ( ) ;
929
929
}
@@ -937,7 +937,7 @@ function getValidStdio(stdio, sync) {
937
937
if ( stdio === 'ignore' ) {
938
938
acc . push ( { type : 'ignore' } ) ;
939
939
} else if ( stdio === 'pipe' || ( typeof stdio === 'number' && stdio < 0 ) ) {
940
- var a = {
940
+ const a = {
941
941
type : 'pipe' ,
942
942
readable : i === 0 ,
943
943
writable : i !== 0
@@ -977,7 +977,7 @@ function getValidStdio(stdio, sync) {
977
977
} ) ;
978
978
} else if ( getHandleWrapType ( stdio ) || getHandleWrapType ( stdio . handle ) ||
979
979
getHandleWrapType ( stdio . _handle ) ) {
980
- var handle = getHandleWrapType ( stdio ) ?
980
+ const handle = getHandleWrapType ( stdio ) ?
981
981
stdio :
982
982
getHandleWrapType ( stdio . handle ) ? stdio . handle : stdio . _handle ;
983
983
@@ -1007,9 +1007,9 @@ function getValidStdio(stdio, sync) {
1007
1007
1008
1008
function getSocketList ( type , worker , key ) {
1009
1009
const sockets = worker . channel . sockets [ type ] ;
1010
- var socketList = sockets [ key ] ;
1010
+ let socketList = sockets [ key ] ;
1011
1011
if ( ! socketList ) {
1012
- var Construct = type === 'send' ? SocketListSend : SocketListReceive ;
1012
+ const Construct = type === 'send' ? SocketListSend : SocketListReceive ;
1013
1013
socketList = sockets [ key ] = new Construct ( worker , key ) ;
1014
1014
}
1015
1015
return socketList ;
@@ -1028,7 +1028,7 @@ function spawnSync(options) {
1028
1028
const result = spawn_sync . spawn ( options ) ;
1029
1029
1030
1030
if ( result . output && options . encoding && options . encoding !== 'buffer' ) {
1031
- for ( var i = 0 ; i < result . output . length ; i ++ ) {
1031
+ for ( let i = 0 ; i < result . output . length ; i ++ ) {
1032
1032
if ( ! result . output [ i ] )
1033
1033
continue ;
1034
1034
result . output [ i ] = result . output [ i ] . toString ( options . encoding ) ;
0 commit comments