diff --git a/internal/console/status.go b/internal/console/status.go index ef74a4e09a..f84f0c8fd1 100644 --- a/internal/console/status.go +++ b/internal/console/status.go @@ -119,8 +119,8 @@ func NewStatusManager(ctx context.Context) StatusManager { }() go func() { - defer sm.exitWait.Done() current := "" + closed := false for { buf := bytes.Buffer{} @@ -130,6 +130,9 @@ func NewStatusManager(ctx context.Context) StatusManager { if current != "" { sm.writeLine(current) } + if !closed { + sm.exitWait.Done() + } return } buf.Write(rawData[:n]) @@ -140,7 +143,10 @@ func NewStatusManager(ctx context.Context) StatusManager { // we keep running though as there may be more data on exit // that we handle on a best effort basis sm.writeLine(current) - sm.exitWait.Done() + if !closed { + sm.exitWait.Done() + closed = true + } continue } if err != nil {