From 5d51c8ffcd87860130ba7d60c5a97a0ad03071f4 Mon Sep 17 00:00:00 2001 From: Alexander Neumann Date: Wed, 19 Aug 2015 21:14:15 +0200 Subject: [PATCH] lock: fix merge error, use processExists() --- lock.go | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/lock.go b/lock.go index 6d65637c1..c305e19e2 100644 --- a/lock.go +++ b/lock.go @@ -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 }