Fixed for process error

This commit is contained in:
Dimitris Zlatanidis 2023-03-09 11:17:33 +02:00
parent 96a8c32d9d
commit 262b23f6be

View file

@ -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():