From 262b23f6bef9debed2d1ab7cebdbad13bbd1d744 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Thu, 9 Mar 2023 11:17:33 +0200 Subject: [PATCH] Fixed for process error --- slpkg/update_repository.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/slpkg/update_repository.py b/slpkg/update_repository.py index 91ed1e00..aa8405da 100644 --- a/slpkg/update_repository.py +++ b/slpkg/update_repository.py @@ -48,8 +48,9 @@ class UpdateRepository(Configs, Utilities): if not self.is_option(self.flag_generate, self.flags): print('Updating the packages list.\n') print("Downloading the 'ponce' repository, please wait...\n") - subprocess.call(f'lftp {self.lftp_mirror_options} {self.ponce_repo_url} {self.ponce_repo_path}', - shell=True) + lftp_output = subprocess.call(f'lftp {self.lftp_mirror_options} {self.ponce_repo_url} ' + f'{self.ponce_repo_path}', shell=True) + self.process_error(lftp_output) # Remove the SLACKBUILDS.TXT file before generating the new one. sbo_file_txt = Path(self.ponce_repo_path, self.ponce_txt) @@ -59,7 +60,8 @@ class UpdateRepository(Configs, Utilities): # Generating the ponce SLACKBUILDS.TXT file. print(f'Generating the {self.ponce_txt} file... ', end='', flush=True) os.chdir(self.ponce_repo_path) - subprocess.call(f'./gen_sbo_txt.sh > {self.ponce_txt}', shell=True) + gen_output = subprocess.call(f'./gen_sbo_txt.sh > {self.ponce_txt}', shell=True) + self.process_error(gen_output) print() else: @@ -80,6 +82,11 @@ class UpdateRepository(Configs, Utilities): data = CreateData() data.install_sbo_table() + @staticmethod + def process_error(output: int): + if output != 0: + raise SystemExit(output) + def check(self) -> None: check_updates = CheckUpdates() if not check_updates.check():