@@ -70,10 +70,10 @@ namespace ts.server.typingsInstaller {
70
70
cwd : string ;
71
71
encoding : "utf-8" ;
72
72
}
73
- type ExecFileSync = ( file : string , args : string [ ] , options : ExecSyncOptions ) => string ;
73
+ type ExecSync = ( command : string , options : ExecSyncOptions ) => string ;
74
74
75
75
export class NodeTypingsInstaller extends TypingsInstaller {
76
- private readonly nodeExecFileSync : ExecFileSync ;
76
+ private readonly nodeExecSync : ExecSync ;
77
77
private readonly npmPath : string ;
78
78
readonly typesRegistry : Map < MapLike < string > > ;
79
79
@@ -97,15 +97,15 @@ namespace ts.server.typingsInstaller {
97
97
this . log . writeLine ( `Process id: ${ process . pid } ` ) ;
98
98
this . log . writeLine ( `NPM location: ${ this . npmPath } (explicit '${ Arguments . NpmLocation } ' ${ npmLocation === undefined ? "not " : "" } provided)` ) ;
99
99
}
100
- ( { execFileSync : this . nodeExecFileSync } = require ( "child_process" ) ) ;
100
+ ( { execSync : this . nodeExecSync } = require ( "child_process" ) ) ;
101
101
102
102
this . ensurePackageDirectoryExists ( globalTypingsCacheLocation ) ;
103
103
104
104
try {
105
105
if ( this . log . isEnabled ( ) ) {
106
106
this . log . writeLine ( `Updating ${ typesRegistryPackageName } npm package...` ) ;
107
107
}
108
- this . execFileSyncAndLog ( this . npmPath , [ " install" , " --ignore-scripts" , ` ${ typesRegistryPackageName } @${ this . latestDistTag } `] , { cwd : globalTypingsCacheLocation } ) ;
108
+ this . execSyncAndLog ( ` ${ this . npmPath } install --ignore-scripts ${ typesRegistryPackageName } @${ this . latestDistTag } `, { cwd : globalTypingsCacheLocation } ) ;
109
109
if ( this . log . isEnabled ( ) ) {
110
110
this . log . writeLine ( `Updated ${ typesRegistryPackageName } npm package` ) ;
111
111
}
@@ -189,20 +189,20 @@ namespace ts.server.typingsInstaller {
189
189
this . log . writeLine ( `#${ requestId } with arguments'${ JSON . stringify ( packageNames ) } '.` ) ;
190
190
}
191
191
const start = Date . now ( ) ;
192
- const hasError = installNpmPackages ( this . npmPath , version , packageNames , ( file , args ) => this . execFileSyncAndLog ( file , args , { cwd } ) ) ;
192
+ const hasError = installNpmPackages ( this . npmPath , version , packageNames , command => this . execSyncAndLog ( command , { cwd } ) ) ;
193
193
if ( this . log . isEnabled ( ) ) {
194
194
this . log . writeLine ( `npm install #${ requestId } took: ${ Date . now ( ) - start } ms` ) ;
195
195
}
196
196
onRequestCompleted ( ! hasError ) ;
197
197
}
198
198
199
199
/** Returns 'true' in case of error. */
200
- private execFileSyncAndLog ( file : string , args : string [ ] , options : Pick < ExecSyncOptions , "cwd" > ) : boolean {
200
+ private execSyncAndLog ( command : string , options : Pick < ExecSyncOptions , "cwd" > ) : boolean {
201
201
if ( this . log . isEnabled ( ) ) {
202
- this . log . writeLine ( `Exec: ${ file } ${ args . join ( " " ) } ` ) ;
202
+ this . log . writeLine ( `Exec: ${ command } ` ) ;
203
203
}
204
204
try {
205
- const stdout = this . nodeExecFileSync ( file , args , { ...options , encoding : "utf-8" } ) ;
205
+ const stdout = this . nodeExecSync ( command , { ...options , encoding : "utf-8" } ) ;
206
206
if ( this . log . isEnabled ( ) ) {
207
207
this . log . writeLine ( ` Succeeded. stdout:${ indent ( sys . newLine , stdout ) } ` ) ;
208
208
}
0 commit comments