Skip to content

Commit

Permalink
Merge pull request docker#1010 from docker/fix-ctrl-c-on-build
Browse files Browse the repository at this point in the history
Give progress its own context
  • Loading branch information
rumpl authored Dec 4, 2020
2 parents 6830ca1 + fcddb77 commit ab8c97d
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion local/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,15 @@ func (s *composeService) build(ctx context.Context, project *types.Project, opts
Driver: d,
},
}

// Progress needs its own context that lives longer than the
// build one otherwise it won't read all the messages from
// build and will lock
progressCtx, cancel := context.WithCancel(context.Background())
defer cancel()
w := progress.NewPrinter(progressCtx, os.Stdout, "auto")

// We rely on buildx "docker" builder integrated in docker engine, so don't need a DockerAPI here
w := progress.NewPrinter(ctx, os.Stdout, "auto")
_, err = build.Build(ctx, driverInfo, opts, nil, nil, w)
return err
}
Expand Down

0 comments on commit ab8c97d

Please sign in to comment.