From a8b21f622fa06e683a80059b5d7f9f6a662800cf Mon Sep 17 00:00:00 2001 From: "Eshan Roy (Eshanized)" Date: Thu, 25 Apr 2024 10:30:58 +0530 Subject: [PATCH] update --- blackbox/Functions.py | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) diff --git a/blackbox/Functions.py b/blackbox/Functions.py index ff3aa84..27271f9 100644 --- a/blackbox/Functions.py +++ b/blackbox/Functions.py @@ -1854,4 +1854,47 @@ def print_running_threads(): for th in threads_alive: logger.debug( "Thread: %s Status: Alive" % th + ) + +def check_holding_queue(self): + while True: + ( + package, + action, + widget, + cmd_str, + progress_dialog, + ) = self.pkg_holding_queue.get() + try: + while check_pacman_lockfile() is True: + time.sleep(0.2) + th_subprocess = Thread( + name = "thread_subprocess", + target = start_subprocess, + args=( + self, + cmd_str, + progress_dialog, + action, + package, + widget, + ), + daemon=True + ) + th_subprocess.start() + finally: + self.pkg_holding_queue.task_done() + +def get_pacman_process(): + try: + for proc in psutil.process_iter(): + try: + pinfo = proc.as_dict(attrs=["pid", "name", "create_time"]) + if pinfo["name"] == "pacman": + return " ".join(proc.cmdline) + except (psutil.NoSuchProcess, psutil.AccessDenied, psutil.ZombieProcess): + pass + except Exception as e: + logger.error( + "Found Exception in LOC1888: %s" % e ) \ No newline at end of file