2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-25 14:17:42 +00:00

Merge pull request #3242 from greatroar/fprintln

internal/ui/termstatus: Use Fprintln to get a newline
This commit is contained in:
MichaelEischer 2021-01-28 20:34:06 +01:00 committed by GitHub
commit 43cb26010a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,9 +210,8 @@ func (t *Terminal) runWithoutStatus(ctx context.Context) {
case stat := <-t.status:
for _, line := range stat.lines {
// ensure that each line ends with newline
withNewline := strings.TrimRight(line, "\n") + "\n"
fmt.Fprint(t.wr, withNewline)
// Ensure that each message ends with exactly one newline.
fmt.Fprintln(t.wr, strings.TrimRight(line, "\n"))
}
if err := t.wr.Flush(); err != nil {
fmt.Fprintf(os.Stderr, "flush failed: %v\n", err)