Skip to content

Commit

Permalink
Don't add extra \n on logs
Browse files Browse the repository at this point in the history
When we print podman-remote logs, we are seeing extra newlines.

Fixes: containers#7942

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Nov 8, 2020
1 parent e2b82e6 commit 47aa926
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/domain/infra/tunnel/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,7 @@ func (ic *ContainerEngine) ContainerLogs(_ context.Context, nameOrIDs []string,
case <-ctx.Done():
return err
case line := <-outCh:
_, _ = io.WriteString(options.Writer, line+"\n")
_, _ = io.WriteString(options.Writer, line)
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions test/e2e/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,4 +337,20 @@ var _ = Describe("Podman logs", func() {
Expect(results).To(Exit(0))
Expect(results.OutputToString()).To(Equal("podman podman podman"))
})

It("Make sure logs match expected length", func() {
logc := podmanTest.Podman([]string{"run", ALPINE, "sh", "-c", "echo 1; echo2"})
logc.WaitWithDefaultTimeout()
Expect(logc).To(Exit(0))
cid := logc.OutputToString()

wait := podmanTest.Podman([]string{"wait", cid})
wait.WaitWithDefaultTimeout()
Expect(wait).To(Exit(0))

results := podmanTest.Podman([]string{"logs", cid})
results.WaitWithDefaultTimeout()
Expect(results).To(Exit(0))
Expect(len(results.OutputToStringArray())).To(Equal(2))
})
})

0 comments on commit 47aa926

Please sign in to comment.