From 9cc04472fb83096960a6bfcef90fff84b8dc0e91 Mon Sep 17 00:00:00 2001 From: Christopher Crone Date: Mon, 6 Jul 2020 13:26:34 +0200 Subject: [PATCH] progress: Stop event on error Ensures that we set an `endTime` when an error event is published. Signed-off-by: Christopher Crone --- progress/tty.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/progress/tty.go b/progress/tty.go index daef04b51..c79e9cf3b 100644 --- a/progress/tty.go +++ b/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