From cfd6d2f5d1c2d5abd38228127f7c95c53f1a1812 Mon Sep 17 00:00:00 2001 From: aiordache Date: Tue, 28 Jul 2020 16:30:08 +0200 Subject: [PATCH] Error out for contexts not implementing compose command Signed-off-by: aiordache --- cli/mobycli/exec.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cli/mobycli/exec.go b/cli/mobycli/exec.go index ec4c89ec..33ce7140 100644 --- a/cli/mobycli/exec.go +++ b/cli/mobycli/exec.go @@ -18,6 +18,7 @@ package mobycli import ( "context" + "errors" "fmt" "os" "os/exec" @@ -51,6 +52,12 @@ func mustDelegateToMoby(ctxType string) bool { // Exec delegates to com.docker.cli if on moby context func Exec(ctx context.Context) { + if os.Args[1] == "compose" { + // command is not implemented for moby or aws context + fmt.Fprintln(os.Stderr, errors.New("'compose' command is not implemented for the context in use")) + os.Exit(1) + } + cmd := exec.CommandContext(ctx, ComDockerCli, os.Args[1:]...) cmd.Stdin = os.Stdin cmd.Stdout = os.Stdout