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

Commit 0b96839

Browse files
authored
Merge pull request #1516 from docker/version_json
don't include stderr in moby exec output
2 parents 31e9396 + 4916b36 commit 0b96839

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
@@ -397,8 +397,7 @@ func TestLegacy(t *testing.T) {
397397
t.Run("host flag", func(t *testing.T) {
398398
res := c.RunDockerOrExitError("-H", "tcp://nonexistent:123", "version")
399399
assert.Assert(t, res.ExitCode == 1)
400-
assert.Assert(t, strings.Contains(res.Stdout(), "dial tcp: lookup nonexistent"), res.Stdout())
401-
400+
assert.Assert(t, strings.Contains(res.Stderr(), "dial tcp: lookup nonexistent"), res.Stderr())
402401
})
403402

404403
t.Run("remote engine context", func(t *testing.T) {
@@ -407,7 +406,7 @@ func TestLegacy(t *testing.T) {
407406

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

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

0 commit comments

Comments
 (0)