From dda8a2a081ec597e5cffb7e7ce82376b25e0a4a5 Mon Sep 17 00:00:00 2001 From: James Lu Date: Sun, 19 Aug 2018 16:58:49 -0700 Subject: [PATCH] launcher: rename has_pid variable to pid_exists This name is a lot more descriptive. --- launcher.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/launcher.py b/launcher.py index e55b476..0703f81 100644 --- a/launcher.py +++ b/launcher.py @@ -25,7 +25,7 @@ def _main(): # Write and check for an existing PID file unless specifically told not to. if not args.no_pid: pidfile = '%s.pid' % conf.confname - has_pid = False + pid_exists = False pid = None if os.path.exists(pidfile): try: @@ -34,22 +34,22 @@ def _main(): except OSError: log.exception("Could not read PID file %s:", pidfile) else: - has_pid = True + pid_exists = True if psutil is not None and os.name == 'posix': # FIXME: Haven't tested this on other platforms, so not turning it on by default. try: proc = psutil.Process(pid) except psutil.NoSuchProcess: # Process doesn't exist! - has_pid = False + pid_exists = False log.info("Ignoring stale PID %s from PID file %r: no such process exists.", pid, pidfile) else: # This PID got reused for something that isn't us? if not any('pylink' in arg.lower() for arg in proc.cmdline()): log.info("Ignoring stale PID %s from PID file %r: process command line %r is not us", pid, pidfile, proc.cmdline()) - has_pid = False + pid_exists = False - if pid and has_pid: + if pid and pid_exists: if args.rehash: os.kill(pid, signal.SIGUSR1) log.info('OK, rehashed PyLink instance %s (config %r)', pid, args.config)