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

Method updateDisplay

util/progress/printer.go:181–225  ·  view source on GitHub ↗
(ctx context.Context, d progressui.Display, ss []*client.SolveStatus)

Source from the content-addressed store, hash-verified

179}
180
181func (p *Printer) updateDisplay(ctx context.Context, d progressui.Display, ss []*client.SolveStatus) ([]client.VertexWarning, []*client.SolveStatus, error) {
182 p.logMu.Lock()
183 p.logSourceMap = map[digest.Digest]any{}
184 p.logMu.Unlock()
185
186 resumeLogs := logutil.Pause(logrus.StandardLogger())
187 defer resumeLogs()
188
189 interruptCh := make(chan interruptRequest, 1)
190 ingress := make(chan *client.SolveStatus)
191
192 go func() {
193 defer close(ingress)
194 defer close(interruptCh)
195
196 for _, s := range ss {
197 ingress <- s
198 }
199
200 for {
201 select {
202 case s, ok := <-p.status:
203 if !ok {
204 return
205 }
206 ingress <- s
207 case req := <-p.interrupt:
208 interruptCh <- req
209 return
210 case <-ctx.Done():
211 return
212 }
213 }
214 }()
215
216 warnings, err := d.UpdateFrom(context.Background(), ingress)
217 if err == nil {
218 err = context.Cause(ctx)
219 }
220
221 interrupt := <-interruptCh
222 p.state = interrupt.desiredState
223 interrupt.close()
224 return warnings, nil, err
225}
226
227// bufferDisplay will buffer display updates from the status channel into a
228// slice.

Callers 1

runMethod · 0.95

Calls 3

PauseFunction · 0.92
DoneMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected