bake: fix printer reset before metadata written

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi 2024-06-28 18:21:19 -07:00
parent 35313e865f
commit cc097db675
No known key found for this signature in database
GPG Key ID: AFA9DE5F8AB7AF39
2 changed files with 8 additions and 6 deletions

View File

@ -302,7 +302,6 @@ func runBake(ctx context.Context, dockerCli command.Cli, targets []string, in ba
}
err = printer.Wait()
printer = nil
if err != nil {
return err
}

View File

@ -19,9 +19,10 @@ import (
type Printer struct {
status chan *client.SolveStatus
ready chan struct{}
done chan struct{}
paused chan struct{}
ready chan struct{}
done chan struct{}
paused chan struct{}
closeOnce sync.Once
err error
warnings []client.VertexWarning
@ -36,8 +37,10 @@ type Printer struct {
}
func (p *Printer) Wait() error {
close(p.status)
<-p.done
p.closeOnce.Do(func() {
close(p.status)
<-p.done
})
return p.err
}