MCPcopy Create free account
hub / github.com/docker/buildx / NewPrinter

Function NewPrinter

util/progress/printer.go:124–152  ·  view source on GitHub ↗
(ctx context.Context, out io.Writer, mode progressui.DisplayMode, opts ...PrinterOpt)

Source from the content-addressed store, hash-verified

122}
123
124func NewPrinter(ctx context.Context, out io.Writer, mode progressui.DisplayMode, opts ...PrinterOpt) (*Printer, error) {
125 opt := &printerOpts{}
126 for _, o := range opts {
127 o(opt)
128 }
129
130 if v := os.Getenv("BUILDKIT_PROGRESS"); v != "" && mode == progressui.AutoMode {
131 mode = progressui.DisplayMode(v)
132 }
133
134 d, err := progressui.NewDisplay(out, mode, opt.displayOpts...)
135 if err != nil {
136 return nil, err
137 }
138
139 pw := &Printer{
140 out: out,
141 mode: mode,
142 opt: opt,
143 status: make(chan *client.SolveStatus),
144 interrupt: make(chan interruptRequest),
145 state: printerStateRunning,
146 done: make(chan struct{}),
147 metrics: opt.mw,
148 }
149 go pw.run(ctx, d)
150
151 return pw, nil
152}
153
154func (p *Printer) run(ctx context.Context, d progressui.Display) {
155 defer close(p.done)

Callers 7

runDialStdioFunction · 0.92
runBuildFunction · 0.92
runBakeFunction · 0.92
runCreateFunction · 0.92
runLogsFunction · 0.92
testDialStdioFunction · 0.92
BootMethod · 0.92

Calls 1

runMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…