Skip to content

Commit ed16aff

Browse files
committed
Use more const
1 parent 99f55b2 commit ed16aff

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

extensions/typescript/src/utils/electron.ts

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,22 @@ function generatePatchedEnv(env: any, stdInPipeName: string, stdOutPipeName: str
5656
return newEnv;
5757
}
5858

59-
export function fork(modulePath: string, args: string[], options: IForkOptions, callback: (error: any, cp: cp.ChildProcess | null) => void): void {
59+
export function fork(
60+
modulePath: string,
61+
args: string[],
62+
options: IForkOptions,
63+
callback: (error: any, cp: cp.ChildProcess | null) => void
64+
): void {
6065

6166
var callbackCalled = false;
62-
var resolve = (result: cp.ChildProcess) => {
67+
const resolve = (result: cp.ChildProcess) => {
6368
if (callbackCalled) {
6469
return;
6570
}
6671
callbackCalled = true;
6772
callback(null, result);
6873
};
69-
var reject = (err: any) => {
74+
const reject = (err: any) => {
7075
if (callbackCalled) {
7176
return;
7277
}
@@ -75,12 +80,12 @@ export function fork(modulePath: string, args: string[], options: IForkOptions,
7580
};
7681

7782
// Generate three unique pipe names
78-
var stdInPipeName = generatePipeName();
79-
var stdOutPipeName = generatePipeName();
80-
let stdErrPipeName = generatePipeName();
83+
const stdInPipeName = generatePipeName();
84+
const stdOutPipeName = generatePipeName();
85+
const stdErrPipeName = generatePipeName();
8186

8287

83-
var newEnv = generatePatchedEnv(process.env, stdInPipeName, stdOutPipeName, stdErrPipeName);
88+
const newEnv = generatePatchedEnv(process.env, stdInPipeName, stdOutPipeName, stdErrPipeName);
8489

8590
var childProcess: cp.ChildProcess;
8691

@@ -108,7 +113,7 @@ export function fork(modulePath: string, args: string[], options: IForkOptions,
108113
stdOutServer.listen(stdOutPipeName);
109114

110115
var serverClosed = false;
111-
var closeServer = () => {
116+
const closeServer = () => {
112117
if (serverClosed) {
113118
return;
114119
}
@@ -118,7 +123,7 @@ export function fork(modulePath: string, args: string[], options: IForkOptions,
118123
};
119124

120125
// Create the process
121-
let bootstrapperPath = path.join(__dirname, 'electronForkStart');
126+
const bootstrapperPath = path.join(__dirname, 'electronForkStart');
122127
childProcess = cp.fork(bootstrapperPath, [modulePath].concat(args), <any>{
123128
silent: true,
124129
cwd: options.cwd,

0 commit comments

Comments
 (0)