@@ -11,7 +11,7 @@ import { flags, FlagsConfig, SfdxCommand, UX } from '@salesforce/command';
11
11
import { fs , Messages } from '@salesforce/core' ;
12
12
import { ensure , Nullable } from '@salesforce/ts-types' ;
13
13
import got from 'got' ;
14
- import { exec , which } from 'shelljs' ;
14
+ import { exec } from 'shelljs' ;
15
15
import * as chalk from 'chalk' ;
16
16
import stripAnsi = require( 'strip-ansi' ) ;
17
17
import { Channel , CLI , ServiceAvailability } from '../../../types' ;
@@ -269,20 +269,15 @@ class Npm extends Method.Base {
269
269
270
270
private test ( ) : Record < CLI , boolean > {
271
271
const results = { } as Record < CLI , boolean > ;
272
- for ( const cli of this . getTargets ( ) ) {
273
- const executable =
274
- this . options . cli === CLI . SFDX && cli === CLI . SF
275
- ? which ( CLI . SF ) . stdout
276
- : path . join ( this . options . directory , 'node_modules' , '.bin' , cli ) ;
277
- this . logger . log ( `Testing ${ chalk . cyan ( executable ) } ` ) ;
272
+ const executable = path . join ( this . options . directory , 'node_modules' , '.bin' , this . options . cli ) ;
273
+ this . logger . log ( `Testing ${ chalk . cyan ( executable ) } ` ) ;
278
274
279
- const result =
280
- process . platform === 'win32'
281
- ? exec ( `& "${ executable } " --version` , { silent : true , shell : 'powershell.exe' } )
282
- : exec ( `${ executable } --version` , { silent : true } ) ;
283
- this . logger . log ( chalk . dim ( ( result . stdout ?? result . stderr ) . replace ( / \n * $ / , '' ) ) ) ;
284
- results [ cli ] = result . code === 0 ;
285
- }
275
+ const result =
276
+ process . platform === 'win32'
277
+ ? exec ( `& "${ executable } " --version` , { silent : true , shell : 'powershell.exe' } )
278
+ : exec ( `${ executable } --version` , { silent : true } ) ;
279
+ this . logger . log ( chalk . dim ( ( result . stdout ?? result . stderr ) . replace ( / \n * $ / , '' ) ) ) ;
280
+ results [ this . options . cli ] = result . code === 0 ;
286
281
return results ;
287
282
}
288
283
}
0 commit comments