Skip to content

Commit

Permalink
Avoid closing stdout and stderr during log close (#2372)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemadero committed Nov 27, 2023
1 parent e04dad8 commit 79e572d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion utils/logging/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package logging

import (
"io"
"os"

"go.uber.org/zap"
"go.uber.org/zap/zapcore"
Expand Down Expand Up @@ -67,7 +68,9 @@ func (l *log) Write(p []byte) (int, error) {
// TODO: return errors here
func (l *log) Stop() {
for _, wc := range l.wrappedCores {
_ = wc.Writer.Close()
if wc.Writer != os.Stdout && wc.Writer != os.Stderr {
_ = wc.Writer.Close()
}
}
}

Expand Down

0 comments on commit 79e572d

Please sign in to comment.