From be6542911f9db8c52ccfcb21f15cbd7fb034cee0 Mon Sep 17 00:00:00 2001 From: Justin Chadwell Date: Thu, 11 May 2023 15:23:36 +0100 Subject: [PATCH] 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 --- util/progress/printer.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/util/progress/printer.go b/util/progress/printer.go index 97ed8833..bb962f53 100644 --- a/util/progress/printer.go +++ b/util/progress/printer.go @@ -120,9 +120,8 @@ func NewPrinter(ctx context.Context, w io.Writer, out console.File, mode string, pw.logSourceMap = map[digest.Digest]interface{}{} pw.logMu.Unlock() - close(pw.ready) - resumeLogs := logutil.Pause(logrus.StandardLogger()) + close(pw.ready) // 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...) resumeLogs()