Skip to content

Commit 99590f1

Browse files
committed
add lock to windows console writer
1 parent f8ba7b4 commit 99590f1

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

console_windows.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ var (
3333
// WriteEntry implements Writer
3434
func (w *ConsoleWriter) WriteEntry(e *Entry) (n int, err error) {
3535
onceConsole.Do(func() { isvt = isVirtualTerminal() })
36+
muConsole.Lock()
37+
defer muConsole.Unlock()
3638

3739
out := w.Writer
3840
if out == nil {
@@ -47,9 +49,6 @@ func (w *ConsoleWriter) WriteEntry(e *Entry) (n int, err error) {
4749
}
4850

4951
func (w *ConsoleWriter) writew(out io.Writer, p []byte) (n int, err error) {
50-
muConsole.Lock()
51-
defer muConsole.Unlock()
52-
5352
b := bbpool.Get().(*bb)
5453
b.B = b.B[:0]
5554
defer bbpool.Put(b)

0 commit comments

Comments
 (0)