@@ -42,7 +42,7 @@ function getWindowsCode(status: number): TerminateResponseCode {
4242export function terminateProcess ( process : cp . ChildProcess , cwd ?: string ) : TerminateResponse {
4343 if ( Platform . isWindows ) {
4444 try {
45- let options : any = {
45+ const options : any = {
4646 stdio : [ 'pipe' , 'pipe' , 'ignore' ]
4747 } ;
4848 if ( cwd ) {
@@ -54,8 +54,8 @@ export function terminateProcess(process: cp.ChildProcess, cwd?: string): Termin
5454 }
5555 } else if ( Platform . isLinux || Platform . isMacintosh ) {
5656 try {
57- let cmd = getPathFromAmdModule ( require , 'vs/base/node/terminateProcess.sh' ) ;
58- let result = cp . spawnSync ( cmd , [ process . pid . toString ( ) ] ) ;
57+ const cmd = getPathFromAmdModule ( require , 'vs/base/node/terminateProcess.sh' ) ;
58+ const result = cp . spawnSync ( cmd , [ process . pid . toString ( ) ] ) ;
5959 if ( result . error ) {
6060 return { success : false , error : result . error } ;
6161 }
@@ -113,7 +113,7 @@ export abstract class AbstractProcess<TProgressData> {
113113 this . shell = arg3 ;
114114 this . options = arg4 ;
115115 } else {
116- let executable = < Executable > arg1 ;
116+ const executable = < Executable > arg1 ;
117117 this . cmd = executable . command ;
118118 this . shell = executable . isShellCommand ;
119119 this . args = executable . args . slice ( 0 ) ;
@@ -124,7 +124,7 @@ export abstract class AbstractProcess<TProgressData> {
124124 this . terminateRequested = false ;
125125
126126 if ( this . options . env ) {
127- let newEnv : IStringDictionary < string > = Object . create ( null ) ;
127+ const newEnv : IStringDictionary < string > = Object . create ( null ) ;
128128 Object . keys ( process . env ) . forEach ( ( key ) => {
129129 newEnv [ key ] = process . env [ key ] ! ;
130130 } ) ;
@@ -137,7 +137,7 @@ export abstract class AbstractProcess<TProgressData> {
137137
138138 public getSanitizedCommand ( ) : string {
139139 let result = this . cmd . toLowerCase ( ) ;
140- let index = result . lastIndexOf ( path . sep ) ;
140+ const index = result . lastIndexOf ( path . sep ) ;
141141 if ( index !== - 1 ) {
142142 result = result . substring ( index + 1 ) ;
143143 }
@@ -154,7 +154,7 @@ export abstract class AbstractProcess<TProgressData> {
154154 return this . useExec ( ) . then ( ( useExec ) => {
155155 let cc : ValueCallback < SuccessData > ;
156156 let ee : ErrorCallback ;
157- let result = new Promise < any > ( ( c , e ) => {
157+ const result = new Promise < any > ( ( c , e ) => {
158158 cc = c ;
159159 ee = e ;
160160 } ) ;
@@ -166,7 +166,7 @@ export abstract class AbstractProcess<TProgressData> {
166166 }
167167 this . childProcess = cp . exec ( cmd , this . options , ( error , stdout , stderr ) => {
168168 this . childProcess = null ;
169- let err : any = error ;
169+ const err : any = error ;
170170 // This is tricky since executing a command shell reports error back in case the executed command return an
171171 // error or the command didn't exist at all. So we can't blindly treat an error as a failed command. So we
172172 // always parse the output and report success unless the job got killed.
@@ -178,11 +178,11 @@ export abstract class AbstractProcess<TProgressData> {
178178 } ) ;
179179 } else {
180180 let childProcess : cp . ChildProcess | null = null ;
181- let closeHandler = ( data : any ) => {
181+ const closeHandler = ( data : any ) => {
182182 this . childProcess = null ;
183183 this . childProcessPromise = null ;
184184 this . handleClose ( data , cc , pp , ee ) ;
185- let result : SuccessData = {
185+ const result : SuccessData = {
186186 terminated : this . terminateRequested
187187 } ;
188188 if ( Types . isNumber ( data ) ) {
@@ -191,12 +191,12 @@ export abstract class AbstractProcess<TProgressData> {
191191 cc ( result ) ;
192192 } ;
193193 if ( this . shell && Platform . isWindows ) {
194- let options : any = Objects . deepClone ( this . options ) ;
194+ const options : any = Objects . deepClone ( this . options ) ;
195195 options . windowsVerbatimArguments = true ;
196196 options . detached = false ;
197197 let quotedCommand : boolean = false ;
198198 let quotedArg : boolean = false ;
199- let commandLine : string [ ] = [ ] ;
199+ const commandLine : string [ ] = [ ] ;
200200 let quoted = this . ensureQuotes ( this . cmd ) ;
201201 commandLine . push ( quoted . value ) ;
202202 quotedCommand = quoted . quoted ;
@@ -207,7 +207,7 @@ export abstract class AbstractProcess<TProgressData> {
207207 quotedArg = quotedArg && quoted . quoted ;
208208 } ) ;
209209 }
210- let args : string [ ] = [
210+ const args : string [ ] = [
211211 '/s' ,
212212 '/c' ,
213213 ] ;
@@ -287,7 +287,7 @@ export abstract class AbstractProcess<TProgressData> {
287287 }
288288 return this . childProcessPromise . then ( ( childProcess ) => {
289289 this . terminateRequested = true ;
290- let result = terminateProcess ( childProcess , this . options . cwd ) ;
290+ const result = terminateProcess ( childProcess , this . options . cwd ) ;
291291 if ( result . success ) {
292292 this . childProcess = null ;
293293 }
@@ -302,7 +302,7 @@ export abstract class AbstractProcess<TProgressData> {
302302 if ( ! this . shell || ! Platform . isWindows ) {
303303 return c ( false ) ;
304304 }
305- let cmdShell = cp . spawn ( getWindowsShell ( ) , [ '/s' , '/c' ] ) ;
305+ const cmdShell = cp . spawn ( getWindowsShell ( ) , [ '/s' , '/c' ] ) ;
306306 cmdShell . on ( 'error' , ( error : Error ) => {
307307 return c ( true ) ;
308308 } ) ;
@@ -326,12 +326,12 @@ export class LineProcess extends AbstractProcess<LineData> {
326326
327327 protected handleExec ( cc : ValueCallback < SuccessData > , pp : ProgressCallback < LineData > , error : Error , stdout : Buffer , stderr : Buffer ) {
328328 [ stdout , stderr ] . forEach ( ( buffer : Buffer , index : number ) => {
329- let lineDecoder = new LineDecoder ( ) ;
330- let lines = lineDecoder . write ( buffer ) ;
329+ const lineDecoder = new LineDecoder ( ) ;
330+ const lines = lineDecoder . write ( buffer ) ;
331331 lines . forEach ( ( line ) => {
332332 pp ( { line : line , source : index === 0 ? Source . stdout : Source . stderr } ) ;
333333 } ) ;
334- let line = lineDecoder . end ( ) ;
334+ const line = lineDecoder . end ( ) ;
335335 if ( line ) {
336336 pp ( { line : line , source : index === 0 ? Source . stdout : Source . stderr } ) ;
337337 }
@@ -343,11 +343,11 @@ export class LineProcess extends AbstractProcess<LineData> {
343343 this . stdoutLineDecoder = new LineDecoder ( ) ;
344344 this . stderrLineDecoder = new LineDecoder ( ) ;
345345 childProcess . stdout . on ( 'data' , ( data : Buffer ) => {
346- let lines = this . stdoutLineDecoder . write ( data ) ;
346+ const lines = this . stdoutLineDecoder . write ( data ) ;
347347 lines . forEach ( line => pp ( { line : line , source : Source . stdout } ) ) ;
348348 } ) ;
349349 childProcess . stderr . on ( 'data' , ( data : Buffer ) => {
350- let lines = this . stderrLineDecoder . write ( data ) ;
350+ const lines = this . stderrLineDecoder . write ( data ) ;
351351 lines . forEach ( line => pp ( { line : line , source : Source . stderr } ) ) ;
352352 } ) ;
353353 }
@@ -380,7 +380,7 @@ export function createQueuedSender(childProcess: cp.ChildProcess): IQueuedSender
380380 return ;
381381 }
382382
383- let result = childProcess . send ( msg , ( error : Error ) => {
383+ const result = childProcess . send ( msg , ( error : Error ) => {
384384 if ( error ) {
385385 console . error ( error ) ; // unlikely to happen, best we can do is log this error
386386 }
@@ -412,7 +412,7 @@ export namespace win32 {
412412 if ( cwd === undefined ) {
413413 cwd = process . cwd ( ) ;
414414 }
415- let dir = path . dirname ( command ) ;
415+ const dir = path . dirname ( command ) ;
416416 if ( dir !== '.' ) {
417417 // We have a directory and the directory is relative (see above). Make the path absolute
418418 // to the current working directory.
0 commit comments