Files
restic/internal/repository/lock_file_windows.go
T
Michael Eischer c87da70af9 repository: separate Lock in-repository from lock handle
Reduce Lock to a pure data transfer object and move the logic to
lockHandle.
2026-06-13 21:33:03 +02:00

23 lines
486 B
Go

package repository
import (
"os"
"github.com/restic/restic/internal/debug"
)
// checkProcess will check if the process retaining the lock exists.
// Returns true if the process exists.
func (l *lockHandle) processExists() bool {
proc, err := os.FindProcess(l.PID)
if err != nil {
debug.Log("error searching for process %d: %v\n", l.PID, err)
return false
}
err = proc.Release()
if err != nil {
debug.Log("error releasing process %d: %v\n", l.PID, err)
}
return true
}