lock: fix merge error, use processExists()

This commit is contained in:
Alexander Neumann 2015-08-19 21:14:15 +02:00
parent b8c0935f8a
commit 5d51c8ffcd
1 changed files with 4 additions and 11 deletions

15
lock.go
View File

@ -207,17 +207,10 @@ func (l *Lock) Stale() bool {
return false
}
proc, err := os.FindProcess(l.PID)
defer proc.Release()
if err != nil {
debug.Log("Lock.Stale", "error searching for process %d: %v\n", l.PID, err)
return true
}
debug.Log("Lock.Stale", "sending SIGHUP to process %d\n", l.PID)
err = proc.Signal(syscall.SIGHUP)
if err != nil {
debug.Log("Lock.Stale", "signal error: %v, lock is probably stale\n", err)
// check if we can reach the process retaining the lock
exists := l.processExists()
if !exists {
debug.Log("Lock.Stale", "could not reach process, %d, lock is probably stale\n", l.PID)
return true
}