From fe42b7d6d41eeffd64f3963802c248cc59deedb2 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 18 Sep 2024 11:46:46 +0100 Subject: bugfix : don't get stuck in progress mode if a package cannot be removed for some reason --- src/backend/pkgremove.py | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/backend') diff --git a/src/backend/pkgremove.py b/src/backend/pkgremove.py index b039f96..552d802 100644 --- a/src/backend/pkgremove.py +++ b/src/backend/pkgremove.py @@ -9,6 +9,7 @@ import signal import selectors import subprocess import sys +import time import sisyphus.checkenv import sisyphus.getclr import sisyphus.getfs @@ -110,6 +111,11 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): p_exe.wait() print( "\nUnable to proceed! There are other packages with dependencies that prevent removal.") + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + os.kill(os.getpid(), signal.SIGTERM) # kill GUI window else: p_exe = subprocess.Popen( ['emerge'] + args + ['--pretend', '--verbose'] + list(pkgname)) @@ -140,10 +146,20 @@ def start(pkgname, depclean=False, gfx_ui=False, unmerge=False): p_exe.wait() print(f"{sisyphus.getclr.bright_red}\nUnable to proceed! Other packages have dependencies preventing removal.{sisyphus.getclr.reset}") print(f"{sisyphus.getclr.bright_white}Use the {sisyphus.getclr.reset}{sisyphus.getclr.green}'--force'{sisyphus.getclr.reset}{sisyphus.getclr.bright_white} option to override at your own risk!{sisyphus.getclr.reset}\n") + sys.exit() else: if is_installed == 0: - print(f"{sisyphus.getclr.bright_red}\nUnable to proceed! One or more selected packages could not be located for removal.\n{sisyphus.getclr.reset}") - sys.exit() + if gfx_ui: + print( + "\nUnable to proceed! One or more selected packages could not be located for removal.") + for i in range(9, 0, -1): + print(f"Killing application in : {i} seconds!") + time.sleep(1) + + os.kill(os.getpid(), signal.SIGTERM) # kill GUI window + else: + print(f"{sisyphus.getclr.bright_red}\nUnable to proceed! One or more selected packages could not be located for removal.\n{sisyphus.getclr.reset}") + sys.exit() else: if unmerge: print(f"\n{sisyphus.getclr.bright_white}Selected packages are slated for{sisyphus.getclr.reset} {sisyphus.getclr.green}'forced'{sisyphus.getclr.reset} {sisyphus.getclr.bright_white}removal.{sisyphus.getclr.reset}\n") -- cgit v1.2.3