No specific case for windows, always resolve binary name before executing command

Signed-off-by: Guillaume Tardif <guillaume.tardif@docker.com>
This commit is contained in:
Guillaume Tardif 2020-11-05 17:05:39 +01:00
parent 41a1553dab
commit 66a1263342
4 changed files with 5 additions and 4 deletions

View File

@ -26,6 +26,7 @@ import (
"github.com/spf13/cobra" "github.com/spf13/cobra"
"github.com/docker/compose-cli/cli/mobycli/resolvepath"
apicontext "github.com/docker/compose-cli/context" apicontext "github.com/docker/compose-cli/context"
"github.com/docker/compose-cli/context/store" "github.com/docker/compose-cli/context/store"
"github.com/docker/compose-cli/metrics" "github.com/docker/compose-cli/metrics"
@ -60,7 +61,7 @@ func mustDelegateToMoby(ctxType string) bool {
// Exec delegates to com.docker.cli if on moby context // Exec delegates to com.docker.cli if on moby context
func Exec(root *cobra.Command) { func Exec(root *cobra.Command) {
execBinary, err := LookPath(ComDockerCli) execBinary, err := resolvepath.LookPath(ComDockerCli)
if err != nil { if err != nil {
fmt.Fprintln(os.Stderr, err) fmt.Fprintln(os.Stderr, err)
os.Exit(1) os.Exit(1)

View File

@ -16,7 +16,7 @@
limitations under the License. limitations under the License.
*/ */
package mobycli package resolvepath
import ( import (
"os/exec" "os/exec"

View File

@ -28,7 +28,7 @@ THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
package mobycli package resolvepath
import ( import (
"errors" "errors"

View File

@ -24,4 +24,4 @@ fi
BASEPATH="${1-}" BASEPATH="${1-}"
ltag -t "${BASEPATH}scripts/validate/template" -excludes "validate testdata cli/mobycli/lp_windows.go" --check -v ltag -t "${BASEPATH}scripts/validate/template" -excludes "validate testdata resolvepath" --check -v