michaelsembwever commented on code in PR #792: URL: https://github.com/apache/cassandra-ccm/pull/792#discussion_r2104138795
########## ccmlib/node.py: ########## @@ -982,6 +985,26 @@ def _wait_for_running(self, process, timeout_s): self._update_pid(process) return self.is_running() + def __unix_kill_process_matching(self, pattern, sig=signal.SIGTERM): + matcher = re.compile(pattern) + for proc in psutil.process_iter(['pid', 'cmdline']): + try: + pid = proc.info['pid'] + cmdline = " ".join(proc.info['cmdline']) if proc.info['cmdline'] else "" + logger.info(f"{cmdline}") + if matcher.search(cmdline): + try: + os.kill(int(pid), sig) + except ProcessLookupError: + logger.info(f"Process {pid} not found") + except PermissionError: + logger.info(f"Did not have permissions to kill {pid}") + except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): + pass + + def __unix_kill(self, sig): + self.__unix_kill_process_matching(".*{}.*{}.*".format(self.__log_dir(), "org.apache.cassandra.service.CassandraDaemon"), sig) Review Comment: using log_dir wfm -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: pr-unsubscr...@cassandra.apache.org For additional commands, e-mail: pr-h...@cassandra.apache.org