Skip to content

Commit 6974f26

Browse files
lcamargofMylesBorins
authored andcommitted
child_process: replace var with const/let in internal/child_process.js
PR-URL: #30414 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
1 parent 46f698f commit 6974f26

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

‎lib/internal/child_process.js‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ const handleConversion = {
105105
// The worker should keep track of the socket
106106
message.key=socket.server._connectionKey;
107107

108-
varfirstTime=!this.channel.sockets.send[message.key];
109-
varsocketList=getSocketList('send',this,message.key);
108+
constfirstTime=!this.channel.sockets.send[message.key];
109+
constsocketList=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-
varsocketList=getSocketList('got',this,message.key);
176+
constsocketList=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-
varsyscall=this.spawnfile ? 'spawn '+this.spawnfile : 'spawn';
263+
constsyscall=this.spawnfile ? 'spawn '+this.spawnfile : 'spawn';
264264
consterr=errnoException(exitCode,syscall);
265265

266266
if(this.spawnfile)
@@ -292,7 +292,7 @@ function flushStdio(subprocess) {
292292

293293
if(stdio==null)return;
294294

295-
for(vari=0;i<stdio.length;i++){
295+
for(leti=0;i<stdio.length;i++){
296296
conststream=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-
varerr=this._handle.kill(signal);
466+
consterr=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-
varqueue=target._handleQueue;
611+
constqueue=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(vari=0;i<queue.length;i++){
622-
varargs=queue[i];
621+
for(leti=0;i<queue.length;i++){
622+
constargs=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-
varfired=false;
855+
letfired=false;
856856
functionfinish(){
857857
if(fired)return;
858858
fired=true;
@@ -901,8 +901,8 @@ function isInternal(message) {
901901
functionnop(){}
902902

903903
functiongetValidStdio(stdio,sync){
904-
varipc;
905-
varipcFd;
904+
letipc;
905+
letipcFd;
906906

907907
// Replace shortcut with an array
908908
if(typeofstdio==='string'){
@@ -921,7 +921,7 @@ function getValidStdio(stdio, sync) {
921921
// (i.e. PipeWraps or fds)
922922
stdio=stdio.reduce((acc,stdio,i)=>{
923923
functioncleanup(){
924-
for(vari=0;i<acc.length;i++){
924+
for(leti=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
}elseif(stdio==='pipe'||(typeofstdio==='number'&&stdio<0)){
938-
vara={
938+
consta={
939939
type: 'pipe',
940940
readable: i===0,
941941
writable: i!==0
@@ -975,7 +975,7 @@ function getValidStdio(stdio, sync) {
975975
});
976976
}elseif(getHandleWrapType(stdio)||getHandleWrapType(stdio.handle)||
977977
getHandleWrapType(stdio._handle)){
978-
varhandle=getHandleWrapType(stdio) ?
978+
consthandle=getHandleWrapType(stdio) ?
979979
stdio :
980980
getHandleWrapType(stdio.handle) ? stdio.handle : stdio._handle;
981981

@@ -1005,9 +1005,9 @@ function getValidStdio(stdio, sync) {
10051005

10061006
functiongetSocketList(type,worker,key){
10071007
constsockets=worker.channel.sockets[type];
1008-
varsocketList=sockets[key];
1008+
letsocketList=sockets[key];
10091009
if(!socketList){
1010-
varConstruct=type==='send' ? SocketListSend : SocketListReceive;
1010+
constConstruct=type==='send' ? SocketListSend : SocketListReceive;
10111011
socketList=sockets[key]=newConstruct(worker,key);
10121012
}
10131013
returnsocketList;
@@ -1027,7 +1027,7 @@ function spawnSync(opts) {
10271027
constresult=spawn_sync.spawn(options);
10281028

10291029
if(result.output&&options.encoding&&options.encoding!=='buffer'){
1030-
for(vari=0;i<result.output.length;i++){
1030+
for(leti=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

Comments
 (0)