github.com/fawick/restic@v0.1.1-0.20171126184616-c02923fbfc79/internal/restic/lock_windows.go (about)

     1  package restic
     2  
     3  import (
     4  	"os"
     5  	"os/user"
     6  
     7  	"github.com/restic/restic/internal/debug"
     8  )
     9  
    10  // uidGidInt always returns 0 on Windows, since uid isn't numbers
    11  func uidGidInt(u user.User) (uid, gid uint32, err error) {
    12  	return 0, 0, nil
    13  }
    14  
    15  // checkProcess will check if the process retaining the lock exists.
    16  // Returns true if the process exists.
    17  func (l Lock) processExists() bool {
    18  	proc, err := os.FindProcess(l.PID)
    19  	if err != nil {
    20  		debug.Log("error searching for process %d: %v\n", l.PID, err)
    21  		return false
    22  	}
    23  	proc.Release()
    24  	return true
    25  }