@@ -24,9 +24,9 @@ export async function rustupUpdate(config: RustupConfig) {
24
24
startSpinner ( 'RLS' , 'Updating…' ) ;
25
25
26
26
try {
27
- const { stdout } = await withWsl ( config . useWSL ) . execFile ( config . path , [
28
- ' update' ,
29
- ] ) ;
27
+ const { stdout } = await withWsl ( config . useWSL ) . exec (
28
+ ` ${ config . path } update` ,
29
+ ) ;
30
30
31
31
// This test is imperfect because if the user has multiple toolchains installed, they
32
32
// might have one updated and one unchanged. But I don't want to go too far down the
@@ -83,10 +83,9 @@ export async function checkForRls(config: RustupConfig) {
83
83
84
84
async function hasToolchain ( config : RustupConfig ) : Promise < boolean > {
85
85
try {
86
- const { stdout } = await withWsl ( config . useWSL ) . execFile ( config . path , [
87
- 'toolchain' ,
88
- 'list' ,
89
- ] ) ;
86
+ const { stdout } = await withWsl ( config . useWSL ) . exec (
87
+ `${ config . path } toolchain list` ,
88
+ ) ;
90
89
return stdout . includes ( config . channel ) ;
91
90
} catch ( e ) {
92
91
console . log ( e ) ;
@@ -130,7 +129,7 @@ async function tryToInstallToolchain(config: RustupConfig) {
130
129
*/
131
130
async function listComponents ( config : RustupConfig ) : Promise < string [ ] > {
132
131
return withWsl ( config . useWSL )
133
- . execFile ( config . path , [ ' component' , ' list' , ' --toolchain' , config . channel ] )
132
+ . exec ( ` ${ config . path } component list --toolchain ${ config . channel } ` )
134
133
. then ( ( { stdout } ) =>
135
134
stdout
136
135
. toString ( )
@@ -226,9 +225,8 @@ export function parseActiveToolchain(rustupOutput: string): string {
226
225
227
226
export async function getVersion ( config : RustupConfig ) : Promise < string > {
228
227
const versionRegex = / r u s t u p ( [ 0 - 9 ] + \. [ 0 - 9 ] + \. [ 0 - 9 ] + ) / ;
229
- const execFile = withWsl ( config . useWSL ) . execFile ;
230
228
231
- const output = await execFile ( config . path , [ ' --version' ] ) ;
229
+ const output = await withWsl ( config . useWSL ) . exec ( ` ${ config . path } --version` ) ;
232
230
const versionMatch = output . stdout . toString ( ) . match ( versionRegex ) ;
233
231
if ( versionMatch && versionMatch . length >= 2 ) {
234
232
return versionMatch [ 1 ] ;
@@ -259,7 +257,7 @@ export function getActiveChannel(wsPath: string, config: RustupConfig): string {
259
257
try {
260
258
// `rustup show active-toolchain` is available since rustup 1.12.0
261
259
activeChannel = withWsl ( config . useWSL )
262
- . execFileSync ( config . path , [ ' show' , ' active-toolchain' ] , { cwd : wsPath } )
260
+ . execSync ( ` ${ config . path } show active-toolchain` , { cwd : wsPath } )
263
261
. toString ( )
264
262
. trim ( ) ;
265
263
// Since rustup 1.17.0 if the active toolchain is the default, we're told
@@ -270,7 +268,7 @@ export function getActiveChannel(wsPath: string, config: RustupConfig): string {
270
268
} catch ( e ) {
271
269
// Possibly an old rustup version, so try rustup show
272
270
const showOutput = withWsl ( config . useWSL )
273
- . execFileSync ( config . path , [ ' show' ] , { cwd : wsPath } )
271
+ . execSync ( ` ${ config . path } show` , { cwd : wsPath } )
274
272
. toString ( ) ;
275
273
activeChannel = parseActiveToolchain ( showOutput ) ;
276
274
}
0 commit comments