File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -55,18 +55,20 @@ func (w *Writer) Sync(sinkName string) {
55
55
return
56
56
}
57
57
err := s .Sync ()
58
- if _ , ok := w .w .(* os.File ); ok {
59
- // Opened files do not necessarily support syncing.
60
- // E.g. stdout and stderr both do not so we need
61
- // to ignore these errors.
62
- // See https://github.com/uber-go/zap/issues/370
63
- // See https://github.com/cdr/slog/pull/43
64
- if errorsIsAny (err , syscall .EINVAL , syscall .ENOTTY , syscall .EBADF ) {
65
- return
58
+ if err != nil {
59
+ if _ , ok := w .w .(* os.File ); ok {
60
+ // Opened files do not necessarily support syncing.
61
+ // E.g. stdout and stderr both do not so we need
62
+ // to ignore these errors.
63
+ // See https://github.com/uber-go/zap/issues/370
64
+ // See https://github.com/cdr/slog/pull/43
65
+ if errorsIsAny (err , syscall .EINVAL , syscall .ENOTTY , syscall .EBADF ) {
66
+ return
67
+ }
66
68
}
67
- }
68
69
69
- w .errorf ("failed to sync %v: %+v" , sinkName , err )
70
+ w .errorf ("failed to sync %v: %+v" , sinkName , err )
71
+ }
70
72
}
71
73
72
74
func errorsIsAny (err error , errs ... error ) bool {
You can’t perform that action at this time.
0 commit comments