@@ -105,8 +105,8 @@ const handleConversion = {
105105// The worker should keep track of the socket
106106message . key = socket . server . _connectionKey ;
107107
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 ) ;
110110
111111// The server should no longer expose a .connection property
112112// and when asked to close it should query the socket status from
@@ -173,7 +173,7 @@ const handleConversion = {
173173if ( message . key ) {
174174
175175// Add socket to connections list
176- var socketList = getSocketList ( 'got' , this , message . key ) ;
176+ const socketList = getSocketList ( 'got' , this , message . key ) ;
177177socketList . add ( {
178178socket : socket
179179} ) ;
@@ -260,7 +260,7 @@ function ChildProcess() {
260260this . _handle = null ;
261261
262262if ( exitCode < 0 ) {
263- var syscall = this . spawnfile ? 'spawn ' + this . spawnfile : 'spawn' ;
263+ const syscall = this . spawnfile ? 'spawn ' + this . spawnfile : 'spawn' ;
264264const err = errnoException ( exitCode , syscall ) ;
265265
266266if ( this . spawnfile )
@@ -292,7 +292,7 @@ function flushStdio(subprocess) {
292292
293293if ( stdio == null ) return ;
294294
295- for ( var i = 0 ; i < stdio . length ; i ++ ) {
295+ for ( let i = 0 ; i < stdio . length ; i ++ ) {
296296const stream = stdio [ i ] ;
297297// TODO(addaleax): This doesn't necessarily account for all the ways in
298298// which data can be read from a stream, e.g. being consumed on the
@@ -463,7 +463,7 @@ ChildProcess.prototype.kill = function(sig) {
463463convertToValidSignal ( sig === undefined ? 'SIGTERM' : sig ) ;
464464
465465if ( this . _handle ) {
466- var err = this . _handle . kill ( signal ) ;
466+ const err = this . _handle . kill ( signal ) ;
467467if ( err === 0 ) {
468468/* Success. */
469469this . killed = true ;
@@ -608,7 +608,7 @@ function setupChannel(target, channel) {
608608}
609609
610610assert ( Array . isArray ( target . _handleQueue ) ) ;
611- var queue = target . _handleQueue ;
611+ const queue = target . _handleQueue ;
612612target . _handleQueue = null ;
613613
614614if ( target . _pendingMessage ) {
@@ -618,8 +618,8 @@ function setupChannel(target, channel) {
618618target . _pendingMessage . callback ) ;
619619}
620620
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 ] ;
623623target . _send ( args . message , args . handle , args . options , args . callback ) ;
624624}
625625
@@ -852,7 +852,7 @@ function setupChannel(target, channel) {
852852if ( this . _pendingMessage )
853853closePendingHandle ( this ) ;
854854
855- var fired = false ;
855+ let fired = false ;
856856function finish ( ) {
857857if ( fired ) return ;
858858fired = true ;
@@ -901,8 +901,8 @@ function isInternal(message) {
901901function nop ( ) { }
902902
903903function getValidStdio ( stdio , sync ) {
904- var ipc ;
905- var ipcFd ;
904+ let ipc ;
905+ let ipcFd ;
906906
907907// Replace shortcut with an array
908908if ( typeof stdio === 'string' ) {
@@ -921,7 +921,7 @@ function getValidStdio(stdio, sync) {
921921// (i.e. PipeWraps or fds)
922922stdio = stdio . reduce ( ( acc , stdio , i ) => {
923923function cleanup ( ) {
924- for ( var i = 0 ; i < acc . length ; i ++ ) {
924+ for ( let i = 0 ; i < acc . length ; i ++ ) {
925925if ( ( acc [ i ] . type === 'pipe' || acc [ i ] . type === 'ipc' ) && acc [ i ] . handle )
926926acc [ i ] . handle . close ( ) ;
927927}
@@ -935,7 +935,7 @@ function getValidStdio(stdio, sync) {
935935if ( stdio === 'ignore' ) {
936936acc . push ( { type : 'ignore' } ) ;
937937} else if ( stdio === 'pipe' || ( typeof stdio === 'number' && stdio < 0 ) ) {
938- var a = {
938+ const a = {
939939type : 'pipe' ,
940940readable : i === 0 ,
941941writable : i !== 0
@@ -975,7 +975,7 @@ function getValidStdio(stdio, sync) {
975975} ) ;
976976} else if ( getHandleWrapType ( stdio ) || getHandleWrapType ( stdio . handle ) ||
977977getHandleWrapType ( stdio . _handle ) ) {
978- var handle = getHandleWrapType ( stdio ) ?
978+ const handle = getHandleWrapType ( stdio ) ?
979979stdio :
980980getHandleWrapType ( stdio . handle ) ? stdio . handle : stdio . _handle ;
981981
@@ -1005,9 +1005,9 @@ function getValidStdio(stdio, sync) {
10051005
10061006function getSocketList ( type , worker , key ) {
10071007const sockets = worker . channel . sockets [ type ] ;
1008- var socketList = sockets [ key ] ;
1008+ let socketList = sockets [ key ] ;
10091009if ( ! socketList ) {
1010- var Construct = type === 'send' ? SocketListSend : SocketListReceive ;
1010+ const Construct = type === 'send' ? SocketListSend : SocketListReceive ;
10111011socketList = sockets [ key ] = new Construct ( worker , key ) ;
10121012}
10131013return socketList ;
@@ -1027,7 +1027,7 @@ function spawnSync(opts) {
10271027const result = spawn_sync . spawn ( options ) ;
10281028
10291029if ( 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 ++ ) {
10311031if ( ! result . output [ i ] )
10321032continue ;
10331033result . output [ i ] = result . output [ i ] . toString ( options . encoding ) ;
0 commit comments