@@ -111,7 +111,7 @@ func (proc *concurrentProcess) wait() {
111111// is resolved in this function.
112112func (proc * concurrentProcess ) newCommandRunner (exe string , combineOutput bool ) (* externalCommand , error ) {
113113 var args []string
114- p , args , err := findExe (exe )
114+ p , args , err := resolveExternalCommand (exe )
115115 if err != nil {
116116 return nil , err
117117 }
@@ -124,16 +124,16 @@ func (proc *concurrentProcess) newCommandRunner(exe string, combineOutput bool)
124124 return cmd , nil
125125}
126126
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 )
129129 if err == nil {
130- return p , nil , nil
130+ return c , nil , nil
131131 }
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
137137 }
138138 }
139139
0 commit comments