restic/lock_windows.go
Klaus Post 35bd8f80c0 Split out process check as separate function.
This will allow the checks to be changed for different operating systems.

Issue  is related to this, but this does not change any current behaviour.
2015-08-16 15:30:36 +02:00

25 lines
551 B
Go

package restic
import (
"os"
"os/user"
"github.com/restic/restic/debug"
)
// uidGidInt always returns 0 on Windows, since uid isn't numbers
func uidGidInt(u user.User) (uid, gid uint32, err error) {
return 0, 0, nil
}
// checkProcess will check if the process retaining the lock exists.
// Returns true if the process exists.
func (l Lock) processExists() bool {
proc, err := os.FindProcess(l.PID)
if err != nil {
debug.Log("Lock.Stale", "error searching for process %d: %v\n", l.PID, err)
return false
}
proc.Release()
return true
}