progressui: fix log line separation bug

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2018-07-03 14:42:13 -07:00
parent 0f20a37814
commit 07d8189603

View File

@@ -212,8 +212,9 @@ func (t *trace) update(s *client.SolveStatus) {
if !ok {
continue // shouldn't happen
}
i := 0
complete := split(l.Data, byte('\n'), func(dt []byte) {
if v.logsPartial && len(v.logs) != 0 {
if v.logsPartial && len(v.logs) != 0 && i == 0 {
v.logs[len(v.logs)-1] = append(v.logs[len(v.logs)-1], dt...)
} else {
ts := time.Duration(0)
@@ -222,6 +223,7 @@ func (t *trace) update(s *client.SolveStatus) {
}
v.logs = append(v.logs, []byte(fmt.Sprintf("#%d %s %s", v.index, fmt.Sprintf("%#.4g", ts.Seconds())[:5], dt)))
}
i++
})
v.logsPartial = !complete
t.updates[v.Digest] = struct{}{}