Debian Codegraph @

src/cmd/internal/robustio/robustio_windows.go

raw
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 if errno, ok := errors.AsType[syscall.Errno](err); ok {
18 switch errno {
19 case syscall.ERROR_ACCESS_DENIED,
20 syscall.ERROR_FILE_NOT_FOUND,
21 windows.ERROR_SHARING_VIOLATION:
22 return true
23 }
24 }
25 return false
26 }