From cc097db675b439e99d0ebb7e524e16ba22f92a6f Mon Sep 17 00:00:00 2001 From: Tonis Tiigi Date: Fri, 28 Jun 2024 18:21:19 -0700 Subject: [PATCH] bake: fix printer reset before metadata written Signed-off-by: Tonis Tiigi --- commands/bake.go | 1 - util/progress/printer.go | 13 ++++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/commands/bake.go b/commands/bake.go index 12c89d53..95b5b658 100644 --- a/commands/bake.go +++ b/commands/bake.go @@ -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 } diff --git a/util/progress/printer.go b/util/progress/printer.go index deef3a67..05201933 100644 --- a/util/progress/printer.go +++ b/util/progress/printer.go @@ -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 }