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

Commit 4916b36

Browse files
committed
don't include stderr in moby exec output
Signed-off-by: Nicolas De Loof <[email protected]>
1 parent 76cd14a commit 4916b36

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

cli/mobycli/exec.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,5 +136,6 @@ func ExecSilent(ctx context.Context, args ...string) ([]byte, error) {
136136
args = os.Args[1:]
137137
}
138138
cmd := exec.CommandContext(ctx, ComDockerCli, args...)
139-
return cmd.CombinedOutput()
139+
cmd.Stderr = os.Stderr
140+
return cmd.Output()
140141
}

local/e2e/cli-only/e2e_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,7 @@ func TestLegacy(t *testing.T) {
398398
t.Run("host flag", func(t *testing.T) {
399399
res := c.RunDockerOrExitError("-H", "tcp://nonexistent:123", "version")
400400
assert.Assert(t, res.ExitCode == 1)
401-
assert.Assert(t, strings.Contains(res.Stdout(), "dial tcp: lookup nonexistent"), res.Stdout())
402-
401+
assert.Assert(t, strings.Contains(res.Stderr(), "dial tcp: lookup nonexistent"), res.Stderr())
403402
})
404403

405404
t.Run("remote engine context", func(t *testing.T) {
@@ -408,7 +407,7 @@ func TestLegacy(t *testing.T) {
408407

409408
res := c.RunDockerOrExitError("version")
410409
assert.Assert(t, res.ExitCode == 1)
411-
assert.Assert(t, strings.Contains(res.Stdout(), "dial tcp: lookup nonexistent"), res.Stdout())
410+
assert.Assert(t, strings.Contains(res.Stderr(), "dial tcp: lookup nonexistent"), res.Stderr())
412411
})
413412

414413
t.Run("existing contexts delegate", func(t *testing.T) {

0 commit comments

Comments
 (0)