@@ -105,8 +105,8 @@ const handleConversion = {
105105 // The worker should keep track of the socket
106106 message.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 = {
173173 if (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);
177177 socketList.add({
178178 socket: socket
179179 });
@@ -260,7 +260,7 @@ function ChildProcess() {
260260 this._handle = null;
261261
262262 if (exitCode < 0) {
263- var syscall = this.spawnfile ? 'spawn ' + this.spawnfile : 'spawn';
263+ const syscall = this.spawnfile ? 'spawn ' + this.spawnfile : 'spawn';
264264 const err = errnoException(exitCode, syscall);
265265
266266 if (this.spawnfile)
@@ -292,7 +292,7 @@ function flushStdio(subprocess) {
292292
293293 if (stdio == null) return;
294294
295- for (var i = 0; i < stdio.length; i++) {
295+ for (let i = 0; i < stdio.length; i++) {
296296 const 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) {
463463 convertToValidSignal(sig === undefined ? 'SIGTERM' : sig);
464464
465465 if (this._handle) {
466- var err = this._handle.kill(signal);
466+ const err = this._handle.kill(signal);
467467 if (err === 0) {
468468 /* Success. */
469469 this.killed = true;
@@ -608,7 +608,7 @@ function setupChannel(target, channel) {
608608 }
609609
610610 assert(Array.isArray(target._handleQueue));
611- var queue = target._handleQueue;
611+ const queue = target._handleQueue;
612612 target._handleQueue = null;
613613
614614 if (target._pendingMessage) {
@@ -618,8 +618,8 @@ function setupChannel(target, channel) {
618618 target._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];
623623 target._send(args.message, args.handle, args.options, args.callback);
624624 }
625625
@@ -852,7 +852,7 @@ function setupChannel(target, channel) {
852852 if (this._pendingMessage)
853853 closePendingHandle(this);
854854
855- var fired = false;
855+ let fired = false;
856856 function finish() {
857857 if (fired) return;
858858 fired = 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
908908 if (typeof stdio === 'string') {
@@ -921,7 +921,7 @@ function getValidStdio(stdio, sync) {
921921 // (i.e. PipeWraps or fds)
922922 stdio = stdio.reduce((acc, stdio, i) => {
923923 function cleanup() {
924- for (var i = 0; i < acc.length; i++) {
924+ for (let i = 0; i < acc.length; i++) {
925925 if ((acc[i].type === 'pipe' || acc[i].type === 'ipc') && acc[i].handle)
926926 acc[i].handle.close();
927927 }
@@ -935,7 +935,7 @@ function getValidStdio(stdio, sync) {
935935 if (stdio === 'ignore') {
936936 acc.push({ type: 'ignore' });
937937 } else if (stdio === 'pipe' || (typeof stdio === 'number' && stdio < 0)) {
938- var a = {
938+ const a = {
939939 type: 'pipe',
940940 readable: i === 0,
941941 writable: i !== 0
@@ -975,7 +975,7 @@ function getValidStdio(stdio, sync) {
975975 });
976976 } else if (getHandleWrapType(stdio) || getHandleWrapType(stdio.handle) ||
977977 getHandleWrapType(stdio._handle)) {
978- var handle = getHandleWrapType(stdio) ?
978+ const handle = getHandleWrapType(stdio) ?
979979 stdio :
980980 getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle;
981981
@@ -1005,9 +1005,9 @@ function getValidStdio(stdio, sync) {
10051005
10061006function getSocketList(type, worker, key) {
10071007 const sockets = worker.channel.sockets[type];
1008- var socketList = sockets[key];
1008+ let socketList = sockets[key];
10091009 if (!socketList) {
1010- var Construct = type === 'send' ? SocketListSend : SocketListReceive;
1010+ const Construct = type === 'send' ? SocketListSend : SocketListReceive;
10111011 socketList = sockets[key] = new Construct(worker, key);
10121012 }
10131013 return socketList;
@@ -1027,7 +1027,7 @@ function spawnSync(opts) {
10271027 const result = spawn_sync.spawn(options);
10281028
10291029 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++) {
10311031 if (!result.output[i])
10321032 continue;
10331033 result.output[i] = result.output[i].toString(options.encoding);
0 commit comments