flockRefreshLock acquires the cross-process refresh lock with flock, creating the lock file's directory first. It is the production implementation used when AuthConfig.acquireRefreshLock is nil. Creating the directory here, behind the seam, keeps every filesystem effect of locking out of tests that
(ctx context.Context, path string)
| 54 | // the production implementation used when AuthConfig.acquireRefreshLock is nil. Creating the directory here, behind the |
| 55 | // seam, keeps every filesystem effect of locking out of tests that stub the seam. |
| 56 | func flockRefreshLock(ctx context.Context, path string) (unlock func(), err error) { |
| 57 | if err := os.MkdirAll(filepath.Dir(path), 0771); err != nil { |
| 58 | return nil, err |
| 59 | } |
| 60 | _, unlock, err = flock.Lock(ctx, path) |
| 61 | return unlock, err |
| 62 | } |
| 63 | |
| 64 | // isRefreshLockInaccessible reports whether err, returned while acquiring the refresh lock, shows that the lock file |
| 65 | // or its directory cannot be created or opened because the filesystem denies the write. That is the case when gh runs |