Skip to content

Commit

Permalink
[exporter/logging] Make knownSyncError a global var
Browse files Browse the repository at this point in the history
  • Loading branch information
mx-psi committed Jun 29, 2022
1 parent be24073 commit 90252fa
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions exporter/loggingexporter/known_sync_error.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,20 @@ import (
"syscall"
)

var knownSyncErrors = []error{
// sync /dev/stdout: invalid argument
syscall.EINVAL,
// sync /dev/stdout: not supported
syscall.ENOTSUP,
// sync /dev/stdout: inappropriate ioctl for device
syscall.ENOTTY,
// sync /dev/stdout: bad file descriptor
syscall.EBADF,
}

// knownSyncError returns true if the given error is one of the known
// non-actionable errors returned by Sync on Linux and macOS.
func knownSyncError(err error) bool {
var knownSyncErrors = []error{
// sync /dev/stdout: invalid argument
syscall.EINVAL,
// sync /dev/stdout: not supported
syscall.ENOTSUP,
// sync /dev/stdout: inappropriate ioctl for device
syscall.ENOTTY,
// sync /dev/stdout: bad file descriptor
syscall.EBADF,
}

for _, syncError := range knownSyncErrors {
if errors.Is(err, syncError) {
return true
Expand Down

0 comments on commit 90252fa

Please sign in to comment.