From 4916b36b9985f7d2364111f1bbd2aa92878e03e1 Mon Sep 17 00:00:00 2001 From: Nicolas De Loof Date: Fri, 9 Apr 2021 15:09:48 +0200 Subject: [PATCH] don't include stderr in moby exec output Signed-off-by: Nicolas De Loof --- cli/mobycli/exec.go | 3 ++- local/e2e/cli-only/e2e_test.go | 5 ++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/mobycli/exec.go b/cli/mobycli/exec.go index d710fdb2..b9beb523 100644 --- a/cli/mobycli/exec.go +++ b/cli/mobycli/exec.go @@ -136,5 +136,6 @@ func ExecSilent(ctx context.Context, args ...string) ([]byte, error) { args = os.Args[1:] } cmd := exec.CommandContext(ctx, ComDockerCli, args...) - return cmd.CombinedOutput() + cmd.Stderr = os.Stderr + return cmd.Output() } diff --git a/local/e2e/cli-only/e2e_test.go b/local/e2e/cli-only/e2e_test.go index 21136ab1..f82a8c9d 100644 --- a/local/e2e/cli-only/e2e_test.go +++ b/local/e2e/cli-only/e2e_test.go @@ -398,8 +398,7 @@ func TestLegacy(t *testing.T) { t.Run("host flag", func(t *testing.T) { res := c.RunDockerOrExitError("-H", "tcp://nonexistent:123", "version") assert.Assert(t, res.ExitCode == 1) - assert.Assert(t, strings.Contains(res.Stdout(), "dial tcp: lookup nonexistent"), res.Stdout()) - + assert.Assert(t, strings.Contains(res.Stderr(), "dial tcp: lookup nonexistent"), res.Stderr()) }) t.Run("remote engine context", func(t *testing.T) { @@ -408,7 +407,7 @@ func TestLegacy(t *testing.T) { res := c.RunDockerOrExitError("version") assert.Assert(t, res.ExitCode == 1) - assert.Assert(t, strings.Contains(res.Stdout(), "dial tcp: lookup nonexistent"), res.Stdout()) + assert.Assert(t, strings.Contains(res.Stderr(), "dial tcp: lookup nonexistent"), res.Stderr()) }) t.Run("existing contexts delegate", func(t *testing.T) {