]> Cypherpunks.ru repositories - gostls13.git/blob - src/testing/testing_windows.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / src / testing / testing_windows.go
1 // Copyright 2021 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 //go:build windows
6
7 package testing
8
9 import (
10         "errors"
11         "internal/syscall/windows"
12         "syscall"
13 )
14
15 // isWindowsRetryable reports whether err is a Windows error code
16 // that may be fixed by retrying a failed filesystem operation.
17 func isWindowsRetryable(err error) bool {
18         for {
19                 unwrapped := errors.Unwrap(err)
20                 if unwrapped == nil {
21                         break
22                 }
23                 err = unwrapped
24         }
25         if err == syscall.ERROR_ACCESS_DENIED {
26                 return true // Observed in https://go.dev/issue/50051.
27         }
28         if err == windows.ERROR_SHARING_VIOLATION {
29                 return true // Observed in https://go.dev/issue/51442.
30         }
31         return false
32 }