Skip to content

Commit 8f2037f

Browse files
authored
Merge pull request #402 from depot/fix/printer-hanging
fix(bake): finish waiting for all printers
2 parents f75d94e + 7b2694f commit 8f2037f

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

pkg/buildx/commands/bake.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,9 @@ func BakeCmd() *cobra.Command {
425425
err = eg.Wait()
426426

427427
// Now wait for the printer to finish and flush all output
428-
_ = printer.Wait()
428+
for range projectIDs {
429+
_ = printer.Wait()
430+
}
429431

430432
// Print save help and linter output after all project builds complete
431433
for _, result := range buildResults {

pkg/progresshelper/shared.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ func (w *SharedPrinter) Add() {
5050

5151
func (w *SharedPrinter) Wait() error {
5252
w.wg.Done()
53-
w.wg.Wait()
54-
55-
w.cancel()
56-
5753
lastPrinter := w.numPrinters.Add(-1) == 0
5854

5955
// The docker progress writer will only return an
@@ -62,6 +58,8 @@ func (w *SharedPrinter) Wait() error {
6258
// Only the last printer will be the one to stop the docker printer as
6359
// the docker printer closes channels.
6460
if lastPrinter {
61+
w.wg.Wait()
62+
w.cancel()
6563
_ = w.printer.Wait()
6664
}
6765

0 commit comments

Comments
 (0)