diff --git a/slpkg/multi_process.py b/slpkg/multi_process.py index 6595a445..195a07b0 100644 --- a/slpkg/multi_process.py +++ b/slpkg/multi_process.py @@ -1,15 +1,16 @@ #!/usr/bin/python3 # -*- coding: utf-8 -*- +import shutil import subprocess from datetime import datetime from multiprocessing import Process from slpkg.configs import Configs from slpkg.utilities import Utilities +from slpkg.error_messages import Errors from slpkg.views.asciibox import AsciiBox from slpkg.progress_bar import ProgressBar -from slpkg.error_messages import Errors class MultiProcess(Configs): @@ -22,6 +23,7 @@ class MultiProcess(Configs): self.ascii = AsciiBox() self.errors = Errors() + self.columns, self.rows = shutil.get_terminal_size() self.timestamp: str = datetime.now().strftime("%Y-%m-%d %H:%M:%S") self.head_message: str = f'Timestamp: {self.timestamp}' self.bottom_message: str = 'EOF - End of log file' @@ -67,12 +69,13 @@ class MultiProcess(Configs): # Terminate process 2 if process 1 finished if not process_1.is_alive(): process_2.terminate() + print(f"\r{' ' * (self.columns - 1)}", end='') # Delete previous line. if process_1.exitcode != 0: - print(f"\r{'':>2}{self.bred}{self.ascii.bullet}{self.endc} {filename} {failed}{' ' * 17}", end='') + print(f"\r{'':>2}{self.bred}{self.ascii.bullet}{self.endc} {filename} {failed}", end='') elif installed: - print(f"\r{'':>2}{self.bred}{self.ascii.bullet}{self.endc} {filename} {skip}{' ' * 17}", end='') + print(f"\r{'':>2}{self.bred}{self.ascii.bullet}{self.endc} {filename} {skip}", end='') else: - print(f"\r{'':>2}{self.bgreen}{self.ascii.bullet}{self.endc} {filename} {done}{' ' * 17}", end='') + print(f"\r{'':>2}{self.bgreen}{self.ascii.bullet}{self.endc} {filename} {done}", end='') # Restore the terminal cursor print('\x1b[?25h', self.endc)