File tree 2 files changed +10
-7
lines changed
2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change 1
1
/* @flow */
2
+ /* eslint-disable max-len */
2
3
3
4
import type { Reporter } from '../../reporters/index.js' ;
4
5
import type Config from '../../config.js' ;
Original file line number Diff line number Diff line change @@ -19,16 +19,18 @@ export const exec = promisify(child.exec);
19
19
20
20
function validate ( program : string , opts ?: Object = { } ) {
21
21
if ( program . includes ( '/' ) ) {
22
- return true ;
22
+ return ;
23
23
}
24
24
25
- const cwd = opts . cwd || process . cwd ( ) ;
26
- const pathext = process . env . PATHEXT || '' ;
25
+ if ( process . platform === 'win32' && process . env . PATHEXT ) {
26
+ const cwd = opts . cwd || process . cwd ( ) ;
27
+ const pathext = process . env . PATHEXT ;
27
28
28
- for ( const ext of pathext . split ( ';' ) ) {
29
- const candidate = path . join ( cwd , `${ program } ${ ext } ` ) ;
30
- if ( fs . existsSync ( candidate ) ) {
31
- throw new Error ( `Potentially dangerous call to "${ program } " in ${ cwd } ` ) ;
29
+ for ( const ext of pathext . split ( ';' ) ) {
30
+ const candidate = path . join ( cwd , `${ program } ${ ext } ` ) ;
31
+ if ( fs . existsSync ( candidate ) ) {
32
+ throw new Error ( `Potentially dangerous call to "${ program } " in ${ cwd } ` ) ;
33
+ }
32
34
}
33
35
}
34
36
}
You can’t perform that action at this time.
0 commit comments