From 66a126334247499c57c94bb20369fa66e371b846 Mon Sep 17 00:00:00 2001 From: Guillaume Tardif Date: Thu, 5 Nov 2020 17:05:39 +0100 Subject: [PATCH] No specific case for windows, always resolve binary name before executing command Signed-off-by: Guillaume Tardif --- cli/mobycli/exec.go | 3 ++- cli/mobycli/{ => resolvepath}/lp_unix.go | 2 +- cli/mobycli/{ => resolvepath}/lp_windows.go | 2 +- scripts/validate/fileheader | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) rename cli/mobycli/{ => resolvepath}/lp_unix.go (97%) rename cli/mobycli/{ => resolvepath}/lp_windows.go (99%) diff --git a/cli/mobycli/exec.go b/cli/mobycli/exec.go index de398785d..15f875091 100644 --- a/cli/mobycli/exec.go +++ b/cli/mobycli/exec.go @@ -26,6 +26,7 @@ import ( "github.com/spf13/cobra" + "github.com/docker/compose-cli/cli/mobycli/resolvepath" apicontext "github.com/docker/compose-cli/context" "github.com/docker/compose-cli/context/store" "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 func Exec(root *cobra.Command) { - execBinary, err := LookPath(ComDockerCli) + execBinary, err := resolvepath.LookPath(ComDockerCli) if err != nil { fmt.Fprintln(os.Stderr, err) os.Exit(1) diff --git a/cli/mobycli/lp_unix.go b/cli/mobycli/resolvepath/lp_unix.go similarity index 97% rename from cli/mobycli/lp_unix.go rename to cli/mobycli/resolvepath/lp_unix.go index 56b1eef65..44caa3648 100644 --- a/cli/mobycli/lp_unix.go +++ b/cli/mobycli/resolvepath/lp_unix.go @@ -16,7 +16,7 @@ limitations under the License. */ -package mobycli +package resolvepath import ( "os/exec" diff --git a/cli/mobycli/lp_windows.go b/cli/mobycli/resolvepath/lp_windows.go similarity index 99% rename from cli/mobycli/lp_windows.go rename to cli/mobycli/resolvepath/lp_windows.go index 9fcafaa60..65d9b5b89 100644 --- a/cli/mobycli/lp_windows.go +++ b/cli/mobycli/resolvepath/lp_windows.go @@ -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. */ -package mobycli +package resolvepath import ( "errors" diff --git a/scripts/validate/fileheader b/scripts/validate/fileheader index d8a5a762a..8b503df36 100755 --- a/scripts/validate/fileheader +++ b/scripts/validate/fileheader @@ -24,4 +24,4 @@ fi BASEPATH="${1-}" -ltag -t "${BASEPATH}scripts/validate/template" -excludes "validate testdata cli/mobycli/lp_windows.go" --check -v \ No newline at end of file +ltag -t "${BASEPATH}scripts/validate/template" -excludes "validate testdata resolvepath" --check -v \ No newline at end of file