From 41a1553dabf3b1b158b2f180c5f495f8ecd3536e 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 | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/cli/mobycli/exec.go b/cli/mobycli/exec.go index 5d1cbc2a4..de398785d 100644 --- a/cli/mobycli/exec.go +++ b/cli/mobycli/exec.go @@ -22,7 +22,6 @@ import ( "os" "os/exec" "os/signal" - "runtime" "strings" "github.com/spf13/cobra" @@ -61,14 +60,10 @@ func mustDelegateToMoby(ctxType string) bool { // Exec delegates to com.docker.cli if on moby context func Exec(root *cobra.Command) { - execBinary := ComDockerCli - if runtime.GOOS == "windows" { // workaround for windows issue https://github.com/golang/go/issues/38736 - var err error - execBinary, err = LookPath(ComDockerCli) - if err != nil { - fmt.Fprintln(os.Stderr, err) - os.Exit(1) - } + execBinary, err := LookPath(ComDockerCli) + if err != nil { + fmt.Fprintln(os.Stderr, err) + os.Exit(1) } cmd := exec.Command(execBinary, os.Args[1:]...) cmd.Stdin = os.Stdin @@ -93,7 +88,7 @@ func Exec(root *cobra.Command) { } }() - err := cmd.Run() + err = cmd.Run() childExit <- true if err != nil { metrics.Track(store.DefaultContextType, os.Args[1:], metrics.FailureStatus)