Separate io.Writer from console.File for NewPrinter

Signed-off-by: Edgar Lee <edgarl@netflix.com>
pull/937/head
Edgar Lee 3 years ago
parent 595285736c
commit 2d7540fb0a

@ -76,7 +76,7 @@ func runBake(dockerCli command.Cli, targets []string, in bakeOptions) (err error
ctx2, cancel := context.WithCancel(context.TODO()) ctx2, cancel := context.WithCancel(context.TODO())
defer cancel() defer cancel()
printer := progress.NewPrinter(ctx2, os.Stderr, in.progress) printer := progress.NewPrinter(ctx2, os.Stderr, os.Stderr, in.progress)
defer func() { defer func() {
if printer != nil { if printer != nil {

@ -239,7 +239,7 @@ func buildTargets(ctx context.Context, dockerCli command.Cli, opts map[string]bu
ctx2, cancel := context.WithCancel(context.TODO()) ctx2, cancel := context.WithCancel(context.TODO())
defer cancel() defer cancel()
printer := progress.NewPrinter(ctx2, os.Stderr, progressMode) printer := progress.NewPrinter(ctx2, os.Stderr, os.Stderr, progressMode)
resp, err := build.Build(ctx, dis, opts, dockerAPI(dockerCli), confutil.ConfigDir(dockerCli), printer) resp, err := build.Build(ctx, dis, opts, dockerAPI(dockerCli), confutil.ConfigDir(dockerCli), printer)
err1 := printer.Wait() err1 := printer.Wait()

@ -414,7 +414,7 @@ func boot(ctx context.Context, ngi *nginfo) (bool, error) {
return false, nil return false, nil
} }
printer := progress.NewPrinter(context.TODO(), os.Stderr, "auto") printer := progress.NewPrinter(context.TODO(), os.Stderr, os.Stderr, "auto")
baseCtx := ctx baseCtx := ctx
eg, _ := errgroup.WithContext(ctx) eg, _ := errgroup.WithContext(ctx)

@ -41,7 +41,7 @@ func (p *Printer) Warnings() []client.VertexWarning {
return p.warnings return p.warnings
} }
func NewPrinter(ctx context.Context, out console.File, mode string) *Printer { func NewPrinter(ctx context.Context, w io.Writer, out console.File, mode string) *Printer {
statusCh := make(chan *client.SolveStatus) statusCh := make(chan *client.SolveStatus)
doneCh := make(chan struct{}) doneCh := make(chan struct{})
@ -56,7 +56,6 @@ func NewPrinter(ctx context.Context, out console.File, mode string) *Printer {
go func() { go func() {
var c console.Console var c console.Console
var w io.Writer = out
switch mode { switch mode {
case PrinterModeQuiet: case PrinterModeQuiet:
w = ioutil.Discard w = ioutil.Discard

Loading…
Cancel
Save