Documentation
¶
Overview ¶
Package lock provides the machine-wide process lock shared by runner run and destructive maintenance commands.
Index ¶
Constants ¶
const DefaultPath = "/tmp/runner.lock"
Variables ¶
var ErrAlreadyRunning = errors.New("another runner is already running")
Functions ¶
func Acquire ¶
Acquire obtains a non-blocking exclusive flock. The file is opened with O_NOFOLLOW and verified as regular so a privileged service cannot be tricked into following a /tmp symlink. The file deliberately remains in place after release: unlinking a flock file can split contenders across two inodes and break mutual exclusion. The lock guards against accidentally starting a second runner; it is not a security boundary against local users.
Types ¶
type AlreadyRunningError ¶
AlreadyRunningError includes best-effort information about the process that currently holds the lock.
func (*AlreadyRunningError) Detail ¶ added in v0.16.0
func (e *AlreadyRunningError) Detail() string
Detail names the lock's holder: its PID, start time and config when the lock file records them, else the held lock's path.
func (*AlreadyRunningError) Error ¶
func (e *AlreadyRunningError) Error() string
func (*AlreadyRunningError) Unwrap ¶
func (e *AlreadyRunningError) Unwrap() error