77import { CoreClrDebugUtil } from './util' ;
88import * as fs from 'fs' ;
99import * as path from 'path' ;
10- import * as child_process from 'child_process' ;
1110import * as fs_extra from 'fs-extra-promise' ;
1211
1312export class InstallError extends Error {
@@ -53,22 +52,22 @@ export class DebugInstaller {
5352 }
5453
5554 public install ( runtimeId : string ) : Promise < void > {
56- var errorBuilder : InstallError = new InstallError ( ) ;
55+ let errorBuilder : InstallError = new InstallError ( ) ;
5756 errorBuilder . installStage = 'writeProjectJson' ;
5857
5958 return this . writeProjectJson ( runtimeId ) . then ( ( ) => {
6059 errorBuilder . installStage = 'dotnetRestore' ;
6160 return this . _util . spawnChildProcess ( 'dotnet' , [ '--verbose' , 'restore' , '--configfile' , 'NuGet.config' ] , this . _util . coreClrDebugDir ( ) ,
6261 ( data : Buffer ) => {
63- var text : string = data . toString ( ) ;
62+ let text : string = data . toString ( ) ;
6463 this . _util . logRaw ( text ) ;
6564
6665 // Certain errors are only logged to stdout.
6766 // Detect these and make a note of the kind of error.
6867 DebugInstaller . parseRestoreErrors ( text , errorBuilder ) ;
6968 } ,
7069 ( data : Buffer ) => {
71- var text : string = data . toString ( ) ;
70+ let text : string = data . toString ( ) ;
7271 this . _util . logRaw ( text ) ;
7372
7473 // Reference errors are sent to stderr at the end of restore.
@@ -78,7 +77,7 @@ export class DebugInstaller {
7877 errorBuilder . installStage = 'dotnetPublish' ;
7978 return this . _util . spawnChildProcess ( 'dotnet' , [ '--verbose' , 'publish' , '-r' , runtimeId , '-o' , this . _util . debugAdapterDir ( ) ] , this . _util . coreClrDebugDir ( ) ,
8079 ( data : Buffer ) => {
81- var text : string = data . toString ( ) ;
80+ let text : string = data . toString ( ) ;
8281 this . _util . logRaw ( text ) ;
8382
8483 DebugInstaller . parsePublishErrors ( text , errorBuilder ) ;
@@ -253,7 +252,7 @@ export class DebugInstaller {
253252 }
254253
255254 private static parseRestoreErrors ( output : string , errorBuilder : InstallError ) : void {
256- var lines : string [ ] = output . replace ( / \r / mg, '' ) . split ( '\n' ) ;
255+ let lines : string [ ] = output . replace ( / \r / mg, '' ) . split ( '\n' ) ;
257256 lines . forEach ( line => {
258257 if ( line . startsWith ( 'error' ) ) {
259258 const connectionError : string = 'The server name or address could not be resolved' ;
@@ -271,16 +270,16 @@ export class DebugInstaller {
271270
272271 private static parseReferenceErrors ( output : string , errorBuilder : InstallError ) : void {
273272 // Reference errors are restated at the end of the output. Find this section first.
274- var errorRegionRegExp : RegExp = / ^ E r r o r s i n .* p r o j e c t \. j s o n $ / gm
275- var beginIndex : number = output . search ( errorRegionRegExp ) ;
276- var errorBlock : string = output . slice ( beginIndex ) ;
273+ let errorRegionRegExp : RegExp = / ^ E r r o r s i n .* p r o j e c t \. j s o n $ / gm;
274+ let beginIndex : number = output . search ( errorRegionRegExp ) ;
275+ let errorBlock : string = output . slice ( beginIndex ) ;
277276
278- var lines : string [ ] = errorBlock . replace ( / \r / mg, '' ) . split ( '\n' ) ;
277+ let lines : string [ ] = errorBlock . replace ( / \r / mg, '' ) . split ( '\n' ) ;
279278 lines . forEach ( line => {
280- var referenceRegExp : RegExp = / ^ (?: \t | \ \ \ \ ) U n a b l e t o r e s o l v e ' ( [ ^ ' ] + ) ' / g
281- var match : RegExpMatchArray ;
279+ let referenceRegExp : RegExp = / ^ (?: \t | \ \ \ \ ) U n a b l e t o r e s o l v e ' ( [ ^ ' ] + ) ' / g;
280+ let match : RegExpMatchArray ;
282281 while ( match = referenceRegExp . exec ( line ) ) {
283- var reference : string = match [ 1 ] ;
282+ let reference : string = match [ 1 ] ;
284283 if ( reference . startsWith ( 'Microsoft' ) ||
285284 reference . startsWith ( 'System' ) ||
286285 reference . startsWith ( 'NETStandard' ) ||
@@ -294,15 +293,15 @@ export class DebugInstaller {
294293 }
295294
296295 private static parsePublishErrors ( output : string , errorBuilder : InstallError ) : void {
297- var lines : string [ ] = output . replace ( / \r / mg, '' ) . split ( '\n' ) ;
296+ let lines : string [ ] = output . replace ( / \r / mg, '' ) . split ( '\n' ) ;
298297 lines . forEach ( line => {
299- var errorTypeRegExp : RegExp = / ^ ( [ \w \. ] + E x c e p t i o n ) / g
300- var typeMatch : RegExpMatchArray ;
298+ const errorTypeRegExp : RegExp = / ^ ( [ \w \. ] + E x c e p t i o n ) / g;
299+ let typeMatch : RegExpMatchArray ;
301300 while ( typeMatch = errorTypeRegExp . exec ( line ) ) {
302- var type : string = typeMatch [ 1 ] ;
301+ let type : string = typeMatch [ 1 ] ;
303302 if ( type === 'System.IO.IOException' ) {
304- var ioExceptionRegExp : RegExp = / S y s t e m \. I O \. I O E x c e p t i o n : T h e p r o c e s s c a n n o t a c c e s s t h e f i l e ' ( .* ) ' b e c a u s e i t i s b e i n g u s e d b y a n o t h e r p r o c e s s ./ g
305- var ioMatch : RegExpMatchArray ;
303+ const ioExceptionRegExp : RegExp = / S y s t e m \. I O \. I O E x c e p t i o n : T h e p r o c e s s c a n n o t a c c e s s t h e f i l e ' ( .* ) ' b e c a u s e i t i s b e i n g u s e d b y a n o t h e r p r o c e s s ./ g;
304+ let ioMatch : RegExpMatchArray ;
306305 if ( ioMatch = ioExceptionRegExp . exec ( line ) ) {
307306 // Remove path as it may contain user information.
308307 errorBuilder . errorMessage = `System.IO.IOException: unable to access '${ path . basename ( ioMatch [ 1 ] ) } '` ;
0 commit comments