error_posix.go 559 Bytes
Newer Older
Fazlul Shahriar's avatar
Fazlul Shahriar committed
1
//+build !windows,!plan9
2 3 4 5 6 7 8 9 10

package cli

import (
	"syscall"
)

func isErrnoNotSupported(err error) bool {
	switch err {
11 12 13 14
	case
		// Operation not supported
		syscall.EINVAL, syscall.EROFS, syscall.ENOTSUP,
		// File descriptor doesn't support syncing (found on MacOS).
15
		syscall.ENOTTY, syscall.ENODEV,
16 17 18 19 20 21
		// MacOS is weird. It returns EBADF when calling fsync on stdout
		// when piped.
		//
		// This is never returned for, e.g., filesystem errors so
		// there's nothing we can do but ignore it and continue.
		syscall.EBADF:
22 23 24 25
		return true
	}
	return false
}