progress: fix race on pausing progress on debug shell

Current progress writer has a logic of pausing/unpausing
the printer and internally recreating internal channels.

This conflicts with a change that added sync.Once to Wait
to allow it being called multiple times without erroring.

In debug shell this could mean that new progress printer
showed up in debug shell because it was not closed.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2025-02-17 20:59:48 -08:00
parent faa573f484
commit 79a978484d

View File

@ -122,6 +122,7 @@ func NewPrinter(ctx context.Context, out console.File, mode progressui.DisplayMo
for { for {
pw.status = make(chan *client.SolveStatus) pw.status = make(chan *client.SolveStatus)
pw.done = make(chan struct{}) pw.done = make(chan struct{})
pw.closeOnce = sync.Once{}
pw.logMu.Lock() pw.logMu.Lock()
pw.logSourceMap = map[digest.Digest]interface{}{} pw.logSourceMap = map[digest.Digest]interface{}{}