# Exclude empty string at end of list
for d in dmns[:-1]:
if re.search(r"%s" % daemon, d):
- daemonpid = self.cmd("cat %s" % d.rstrip()).rstrip()
+ daemonpidfile = d.rstrip()
+ daemonpid = self.cmd("cat %s" % daemonpidfile).rstrip()
if daemonpid.isdigit() and pid_exists(int(daemonpid)):
logger.info(
"{}: killing {}".format(
self.name,
- os.path.basename(d.rstrip().rsplit(".", 1)[0]),
+ os.path.basename(daemonpidfile.rsplit(".", 1)[0]),
)
)
- self.cmd("kill -9 %s" % daemonpid)
+ os.kill(int(daemonpid), signal.SIGKILL)
if pid_exists(int(daemonpid)):
numRunning += 1
while wait and numRunning > 0:
),
)
)
- self.cmd("kill -9 %s" % daemonpid)
+ os.kill(int(daemonpid), signal.SIGKILL)
if daemonpid.isdigit() and not pid_exists(
int(daemonpid)
):
numRunning -= 1
- self.cmd("rm -- {}".format(d.rstrip()))
+ self.cmd("rm -- {}".format(daemonpidfile))
if wait:
errors = self.checkRouterCores(reportOnce=True)
if self.checkRouterVersion("<", minErrorVersion):