github.com/go-asm/go@v1.21.1-0.20240213172139-40c5ead50c48/cmd/go/robustio/robustio_windows.go (about) 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 "syscall" 10 11 "github.com/go-asm/go/syscall/windows" 12 ) 13 14 const errFileNotFound = syscall.ERROR_FILE_NOT_FOUND 15 16 // isEphemeralError returns true if err may be resolved by waiting. 17 func isEphemeralError(err error) bool { 18 var errno syscall.Errno 19 if errors.As(err, &errno) { 20 switch errno { 21 case syscall.ERROR_ACCESS_DENIED, 22 syscall.ERROR_FILE_NOT_FOUND, 23 windows.ERROR_SHARING_VIOLATION: 24 return true 25 } 26 } 27 return false 28 }