Explorar o código

progress: Stop event on error

Ensures that we set an `endTime` when an error event is published.

Signed-off-by: Christopher Crone <[email protected]>
Christopher Crone %!s(int64=5) %!d(string=hai) anos
pai
achega
9cc04472fb
Modificáronse 1 ficheiros con 5 adicións e 2 borrados
  1. 5 2
      progress/tty.go

+ 5 - 2
progress/tty.go

@@ -68,8 +68,11 @@ func (w *ttyWriter) Event(e Event) {
 	}
 	if _, ok := w.events[e.ID]; ok {
 		event := w.events[e.ID]
-		if event.Status != Done && e.Status == Done {
-			event.stop()
+		switch e.Status {
+		case Done, Error:
+			if event.Status != e.Status {
+				event.stop()
+			}
 		}
 		event.Status = e.Status
 		event.Text = e.Text