1 // Copyright 2019 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package robustio 6 7 import ( 8 "errors" 9 "internal/syscall/windows" 10 "syscall" 11 ) 12 13 const errFileNotFound = syscall.ERROR_FILE_NOT_FOUND 14 15 // isEphemeralError returns true if err may be resolved by waiting. 16 func isEphemeralError(err error) bool { 17 var errno syscall.Errno 18 if errors.As(err, &errno) { 19 switch errno { 20 case syscall.ERROR_ACCESS_DENIED, 21 syscall.ERROR_FILE_NOT_FOUND, 22 windows.ERROR_SHARING_VIOLATION: 23 return true 24 } 25 } 26 return false 27 } 28