mirror of
https://gitea.com/Lydanne/buildx.git
synced 2025-05-18 09:17:49 +08:00
progress: make printer ready only after pausing logrus
This fixes a possible race where messages printed directly after calls to NewPrinter may appear before the printer starts. With this change, we delay all of the logs until after. Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
9b07f6510a
commit
be6542911f
@ -120,9 +120,8 @@ func NewPrinter(ctx context.Context, w io.Writer, out console.File, mode string,
|
|||||||
pw.logSourceMap = map[digest.Digest]interface{}{}
|
pw.logSourceMap = map[digest.Digest]interface{}{}
|
||||||
pw.logMu.Unlock()
|
pw.logMu.Unlock()
|
||||||
|
|
||||||
close(pw.ready)
|
|
||||||
|
|
||||||
resumeLogs := logutil.Pause(logrus.StandardLogger())
|
resumeLogs := logutil.Pause(logrus.StandardLogger())
|
||||||
|
close(pw.ready)
|
||||||
// not using shared context to not disrupt display but let is finish reporting errors
|
// not using shared context to not disrupt display but let is finish reporting errors
|
||||||
pw.warnings, pw.err = progressui.DisplaySolveStatus(ctx, c, w, pw.status, opt.displayOpts...)
|
pw.warnings, pw.err = progressui.DisplaySolveStatus(ctx, c, w, pw.status, opt.displayOpts...)
|
||||||
resumeLogs()
|
resumeLogs()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user