@@ -111,7 +111,7 @@ func (proc *concurrentProcess) wait() {
111
111
// is resolved in this function.
112
112
func (proc * concurrentProcess ) newCommandRunner (exe string , combineOutput bool ) (* externalCommand , error ) {
113
113
var args []string
114
- p , args , err := findExe (exe )
114
+ p , args , err := resolveExternalCommand (exe )
115
115
if err != nil {
116
116
return nil , err
117
117
}
@@ -124,16 +124,16 @@ func (proc *concurrentProcess) newCommandRunner(exe string, combineOutput bool)
124
124
return cmd , nil
125
125
}
126
126
127
- func findExe (exe string ) (string , []string , error ) {
128
- p , err := execabs .LookPath (exe )
127
+ func resolveExternalCommand (exe string ) (string , []string , error ) {
128
+ c , err := execabs .LookPath (exe )
129
129
if err == nil {
130
- return p , nil , nil
130
+ return c , nil , nil
131
131
}
132
- // See if the command string contains args. As it is best effort, we do not
133
- // handle parse errors .
134
- if exeArgs , _ := shellwords .Parse (exe ); len (exeArgs ) > 0 {
135
- if p , err := execabs .LookPath (exeArgs [0 ]); err == nil {
136
- return p , exeArgs [1 :], nil
132
+
133
+ // Try to parse the string as a command line instead of a single executable file path .
134
+ if a , err := shellwords .Parse (exe ); err == nil && len (a ) > 0 {
135
+ if c , err := execabs .LookPath (a [0 ]); err == nil {
136
+ return c , a [1 :], nil
137
137
}
138
138
}
139
139
0 commit comments