@@ -23,15 +23,21 @@ export class CLI {
23
23
this . _gaugePlugins = manifest . plugins ;
24
24
}
25
25
26
+ public static getDefaultSpawnOptions ( ) : CommonSpawnOptions {
27
+ // should only deal with platform specific options
28
+ let options : CommonSpawnOptions = { } ;
29
+ if ( platform ( ) === "win32" ) {
30
+ options . shell = true ;
31
+ }
32
+ return options ;
33
+ }
34
+
26
35
public static instance ( ) : CLI {
27
36
const gaugeCommand = this . getCommand ( GaugeCommands . Gauge ) ;
28
37
let mvnCommand = this . getCommand ( MAVEN_COMMAND ) ;
29
38
let gradleCommand = this . getGradleCommand ( ) ;
30
39
if ( ! gaugeCommand || gaugeCommand === '' ) return new CLI ( gaugeCommand , { } , mvnCommand , gradleCommand ) ;
31
- let options : CommonSpawnOptions = { } ;
32
- if ( platform ( ) === "win32" ) {
33
- options . shell = true ;
34
- }
40
+ let options = this . getDefaultSpawnOptions ( ) ;
35
41
let gv = spawnSync (
36
42
gaugeCommand ,
37
43
[ GaugeCommands . Version , GaugeCommands . MachineReadable ] ,
@@ -75,10 +81,7 @@ export class CLI {
75
81
let oc = window . createOutputChannel ( "Gauge Install" ) ;
76
82
let chan = new OutputChannel ( oc , `Installing gauge ${ language } plugin ...\n` , "" ) ;
77
83
return new Promise ( ( resolve , reject ) => {
78
- let options : CommonSpawnOptions = { } ;
79
- if ( platform ( ) === "win32" ) {
80
- options . shell = true ;
81
- }
84
+ let options = CLI . getDefaultSpawnOptions ( ) ;
82
85
let childProcess = spawn (
83
86
this . _gaugeCommand ,
84
87
[ GaugeCommands . Install , language ] ,
@@ -118,10 +121,9 @@ export class CLI {
118
121
119
122
private static getCommand ( command : string ) : string {
120
123
let validExecExt = [ "" ] ;
121
- let options : CommonSpawnOptions = { } ;
124
+ let options = CLI . getDefaultSpawnOptions ( ) ;
122
125
if ( platform ( ) === 'win32' ) {
123
126
validExecExt . push ( ".bat" , ".exe" , ".cmd" ) ;
124
- options . shell = true ;
125
127
}
126
128
for ( const ext of validExecExt ) {
127
129
let executable = `${ command } ${ ext } ` ;
0 commit comments