From 3bec484f1d766a4d498f1322cf5e5ffbb33462fd Mon Sep 17 00:00:00 2001 From: Cristian Maglie Date: Wed, 13 May 2020 12:10:55 +0200 Subject: [PATCH] Fixed race condition in legacy i18n.LoggerToCustomStreams --- legacy/builder/i18n/i18n.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/legacy/builder/i18n/i18n.go b/legacy/builder/i18n/i18n.go index c40c6d45b18..0cc3112940f 100644 --- a/legacy/builder/i18n/i18n.go +++ b/legacy/builder/i18n/i18n.go @@ -40,9 +40,12 @@ type Logger interface { type LoggerToCustomStreams struct { Stdout io.Writer Stderr io.Writer + mux sync.Mutex } func (s LoggerToCustomStreams) Fprintln(w io.Writer, level string, format string, a ...interface{}) { + s.mux.Lock() + defer s.mux.Unlock() target := s.Stdout if w == os.Stderr { target = s.Stderr @@ -51,6 +54,8 @@ func (s LoggerToCustomStreams) Fprintln(w io.Writer, level string, format string } func (s LoggerToCustomStreams) UnformattedFprintln(w io.Writer, str string) { + s.mux.Lock() + defer s.mux.Unlock() target := s.Stdout if w == os.Stderr { target = s.Stderr @@ -59,6 +64,8 @@ func (s LoggerToCustomStreams) UnformattedFprintln(w io.Writer, str string) { } func (s LoggerToCustomStreams) UnformattedWrite(w io.Writer, data []byte) { + s.mux.Lock() + defer s.mux.Unlock() target := s.Stdout if w == os.Stderr { target = s.Stderr pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy