MCPcopy Create free account
hub / github.com/cli/cli / isRefreshLockInaccessible

Function isRefreshLockInaccessible

internal/config/refreshable.go:71–77  ·  view source on GitHub ↗

isRefreshLockInaccessible reports whether err, returned while acquiring the refresh lock, shows that the lock file or its directory cannot be created or opened because the filesystem denies the write. That is the case when gh runs in a sandbox that makes its state directory read-only, which also pre

(err error)

Source from the content-addressed store, hash-verified

69// the locking syscall itself (for example a filesystem without advisory locking) and lock contention timeouts are
70// bare errors, so they are deliberately not classified as inaccessible.
71func isRefreshLockInaccessible(err error) bool {
72 var pathErr *fs.PathError
73 if !errors.As(err, &pathErr) {
74 return false
75 }
76 return errors.Is(pathErr.Err, fs.ErrPermission) || errors.Is(pathErr.Err, syscall.EROFS)
77}
78
79// withFreshConfigForRefresh runs fn, a credential-store read-modify-write (a token refresh, or a logout that must not
80// race one), while holding both an in-process mutex and a cross-process advisory lock, and reloads the configuration

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected