Skip to content

Commit

Permalink
Fix printing status while waiting for bgrun to exit gracefully
Browse files Browse the repository at this point in the history
Without the \r the cursor wouldn't go back to column 0, and it wouldn't
update the current line.
  • Loading branch information
arp242 committed Aug 25, 2024
1 parent bb47615 commit b80e65f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/goatcounter/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,15 +306,15 @@ func doServe(ctx context.Context, db zdb.DB,
time.Sleep(100 * time.Millisecond)

zli.Erase()
fmt.Fprintf(zli.Stdout, "%d tasks: ", len(r))
fmt.Fprintf(zli.Stdout, "\r%d tasks: ", len(r))
for i, t := range r {
if i > 0 {
fmt.Fprint(zli.Stdout, ", ")
}
fmt.Fprintf(zli.Stdout, "%s (%s)", t.Task, time.Since(t.Started).Round(time.Second))
}
}

fmt.Fprintln(zli.Stdout)
db.Close()
return nil
}
Expand Down

0 comments on commit b80e65f

Please sign in to comment.