1
1
'use strict' ;
2
2
3
- import { CommonSpawnOptions , spawn , spawnSync } from 'child_process' ;
4
- import { platform } from 'os' ;
5
- import { window } from 'vscode' ;
6
- import { GaugeCommands , GRADLE_COMMAND , MAVEN_COMMAND } from './constants' ;
7
- import { OutputChannel } from './execution/outputChannel' ;
3
+ import { CommonSpawnOptions , spawn , spawnSync } from 'child_process' ;
4
+ import { platform } from 'os' ;
5
+ import { window } from 'vscode' ;
6
+ import { GaugeCommands , GRADLE_COMMAND , MAVEN_COMMAND } from './constants' ;
7
+ import { OutputChannel } from './execution/outputChannel' ;
8
8
9
9
export class CLI {
10
10
private readonly _gaugeVersion : string ;
@@ -25,11 +25,7 @@ export class CLI {
25
25
26
26
public static getDefaultSpawnOptions ( ) : CommonSpawnOptions {
27
27
// should only deal with platform specific options
28
- let options : CommonSpawnOptions = { } ;
29
- if ( platform ( ) === "win32" ) {
30
- options . shell = true ;
31
- }
32
- return options ;
28
+ return platform ( ) === "win32" ? { shell : true } : { } ;
33
29
}
34
30
35
31
public static instance ( ) : CLI {
@@ -112,11 +108,8 @@ export class CLI {
112
108
}
113
109
114
110
public static getCommandCandidates ( command : string ) : string [ ] {
115
- let validExecExt = [ "" ] ;
116
- if ( platform ( ) === 'win32' ) {
117
- validExecExt . push ( ".exe" , ".bat" , ".cmd" ) ;
118
- }
119
- return validExecExt . map ( ( ext ) => `${ command } ${ ext } ` ) ;
111
+ return ( platform ( ) === 'win32' ? [ ".exe" , ".bat" , ".cmd" ] : [ "" ] )
112
+ . map ( ( ext ) => `${ command } ${ ext } ` ) ;
120
113
}
121
114
122
115
public static checkSpawnable ( command : string ) : boolean {
@@ -132,7 +125,6 @@ export class CLI {
132
125
}
133
126
134
127
private static getGradleCommand ( ) {
135
- if ( platform ( ) === 'win32' ) return `${ GRADLE_COMMAND } .bat` ;
136
- return `./${ GRADLE_COMMAND } ` ;
128
+ return platform ( ) === 'win32' ? `${ GRADLE_COMMAND } .bat` : `./${ GRADLE_COMMAND } ` ;
137
129
}
138
130
}
0 commit comments