From 96c103b6f4738ac64756f499e8625746ab75ed30 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 27 Feb 2019 02:31:46 -0800 Subject: [PATCH] fix sync error with go1.12 on darwin In go1.12, go switched how `file.Sync()` works on macos. Unfortunately, this also changed the "not supported" error to ENOTTY (called ENOTTY for legacy reasons) on macos. fixes ipfs/go-ipfs#6028 --- cli/error_posix.go | 2 +- cli/error_windows.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/error_posix.go b/cli/error_posix.go index f9d52a3a..f00589e1 100644 --- a/cli/error_posix.go +++ b/cli/error_posix.go @@ -8,7 +8,7 @@ import ( func isErrnoNotSupported(err error) bool { switch err { - case syscall.EINVAL, syscall.ENOTSUP: + case syscall.EINVAL, syscall.ENOTSUP, syscall.ENOTTY: return true } return false diff --git a/cli/error_windows.go b/cli/error_windows.go index 0c882846..f29994a7 100644 --- a/cli/error_windows.go +++ b/cli/error_windows.go @@ -10,7 +10,7 @@ const invalid_file_handle syscall.Errno = 0x6 func isErrnoNotSupported(err error) bool { switch err { - case syscall.EINVAL, syscall.ENOTSUP, invalid_file_handle: + case syscall.EINVAL, syscall.ENOTSUP, syscall.ENOTTY, invalid_file_handle: return true } return false