Skip to content
This repository was archived by the owner on Nov 27, 2023. It is now read-only.

Commit f3b3259

Browse files
committed
No specific case for windows, always resolve binary name before executing command
1 parent d731fdf commit f3b3259

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

cli/mobycli/exec.go

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"os"
2323
"os/exec"
2424
"os/signal"
25-
"runtime"
2625
"strings"
2726

2827
"github.com/spf13/cobra"
@@ -61,14 +60,10 @@ func mustDelegateToMoby(ctxType string) bool {
6160

6261
// Exec delegates to com.docker.cli if on moby context
6362
func Exec(root *cobra.Command) {
64-
execBinary := ComDockerCli
65-
if runtime.GOOS == "windows" { // workaround for windows issue https://github.com/golang/go/issues/38736
66-
var err error
67-
execBinary, err = LookPath(ComDockerCli)
68-
if err != nil {
69-
fmt.Fprintln(os.Stderr, err)
70-
os.Exit(1)
71-
}
63+
execBinary, err := LookPath(ComDockerCli)
64+
if err != nil {
65+
fmt.Fprintln(os.Stderr, err)
66+
os.Exit(1)
7267
}
7368
cmd := exec.Command(execBinary, os.Args[1:]...)
7469
cmd.Stdin = os.Stdin
@@ -93,7 +88,7 @@ func Exec(root *cobra.Command) {
9388
}
9489
}()
9590

96-
err := cmd.Run()
91+
err = cmd.Run()
9792
childExit <- true
9893
if err != nil {
9994
metrics.Track(store.DefaultContextType, os.Args[1:], metrics.FailureStatus)

0 commit comments

Comments
 (0)