From 1c70d911daafae7377454c17886dd428fb8958be Mon Sep 17 00:00:00 2001 From: Ludovic <54670129+lbr38@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:04:12 +0200 Subject: [PATCH] 3.1.4 --- src/controllers/Package/Apt.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/controllers/Package/Apt.py b/src/controllers/Package/Apt.py index 60e575d..9804853 100644 --- a/src/controllers/Package/Apt.py +++ b/src/controllers/Package/Apt.py @@ -102,15 +102,20 @@ def get_available_packages(self): # #----------------------------------------------------------------------------------------------- def clear_cache(self): - result = subprocess.run( - ["apt", "clean"], - stdout = subprocess.PIPE, # subprocess.PIPE & subprocess.PIPE are alias of 'capture_output = True' - stderr = subprocess.PIPE, - universal_newlines = True # Alias of 'text = True' - ) + try: + self.aptcache.clear() + except Exception as e: + raise Exception('could not clear apt cache: ' + str(e)) - if result.returncode != 0: - raise Exception('could not clear apt cache: ' + result.stderr) + # result = subprocess.run( + # ["apt", "clean"], + # stdout = subprocess.PIPE, # subprocess.PIPE & subprocess.PIPE are alias of 'capture_output = True' + # stderr = subprocess.PIPE, + # universal_newlines = True # Alias of 'text = True' + # ) + + # if result.returncode != 0: + # raise Exception('could not clear apt cache: ' + result.stderr) #-----------------------------------------------------------------------------------------------