ui: Fix data race and minor API cleanup (#21801)

This commit is contained in:
Michael Eischer
2026-05-15 21:23:24 +02:00
committed by GitHub
parent 6de6cc6c75
commit 265d070255
2 changed files with 6 additions and 5 deletions
+2 -2
View File
@@ -131,11 +131,11 @@ func (p *Progress) ReportDeletion(name string) {
return
}
p.s.FilesDeleted++
p.m.Lock()
defer p.m.Unlock()
p.s.FilesDeleted++
p.printer.CompleteItem(ActionDeleted, name, 0)
}
+4 -3
View File
@@ -394,15 +394,16 @@ func (t *Terminal) Error(line string) {
}
func sanitizeLines(lines []string, width int) []string {
sanitized := make([]string, len(lines))
// Sanitize lines and truncate them if they're too long.
for i, line := range lines {
line = ui.Quote(line)
if width > 0 {
line = ui.Truncate(line, width-2)
}
lines[i] = line
sanitized[i] = line
}
return lines
return sanitized
}
// SetStatus updates the status lines.
@@ -419,7 +420,7 @@ func (t *Terminal) SetStatus(lines []string) {
}
}
sanitizeLines(lines, width)
lines = sanitizeLines(lines, width)
select {
case t.status <- status{lines: lines}: