Handle when pid file is corrupt

Fix #1090
This commit is contained in:
Julien Duponchelle 2017-07-20 16:17:07 +02:00
parent ec4e69b0d8
commit 87838cb574
No known key found for this signature in database
GPG Key ID: CE8B29639E07F5E8

View File

@ -158,10 +158,10 @@ def pid_lock(path):
pid = None
try:
with open(path) as f:
pid = int(f.read())
try:
pid = int(f.read())
os.kill(pid, 0) # If the proces is not running kill return an error
except (OSError, SystemError):
except (OSError, SystemError, ValueError):
pid = None
except OSError as e:
log.critical("Can't open pid file %s: %s", pid, str(e))