From ccce61a9b540fa479f49128676dbb5db90c992d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vin=C3=ADcius=20Moreira?= Date: Wed, 15 Apr 2020 12:55:01 -0300 Subject: [PATCH] [improvement][arch] using unified subprocess output when installing packages to prevent wrong error results --- bauh/gems/arch/controller.py | 19 ++++++++++--------- bauh/gems/arch/pacman.py | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/bauh/gems/arch/controller.py b/bauh/gems/arch/controller.py index 9df10d07..b3d43282 100644 --- a/bauh/gems/arch/controller.py +++ b/bauh/gems/arch/controller.py @@ -728,7 +728,7 @@ class ArchManager(SoftwareManager): try: output_handler = TransactionStatusHandler(watcher, self.i18n, len(repo_pkgs_names), self.logger) output_handler.start() - success = handler.handle_simple(pacman.upgrade_several(repo_pkgs_names, root_password), output_handler=output_handler.handle) + success, _ = handler.handle_simple(pacman.upgrade_several(repo_pkgs_names, root_password), output_handler=output_handler.handle) output_handler.stop_working() output_handler.join() @@ -1107,9 +1107,10 @@ class ArchManager(SoftwareManager): status_handler = TransactionStatusHandler(context.watcher, self.i18n, len(repo_deps), self.logger, percentage=len(repo_deps) > 1) status_handler.start() - installed = context.handler.handle(pacman.install_as_process(pkgpaths=repo_deps, - root_password=context.root_password, - file=False), output_handler=status_handler.handle) + installed, _ = context.handler.handle_simple(pacman.install_as_process(pkgpaths=repo_deps, + root_password=context.root_password, + file=False), + output_handler=status_handler.handle) if installed: progress += len(repo_deps) * progress_increment @@ -1459,11 +1460,11 @@ class ArchManager(SoftwareManager): else: status_handler = None - installed = context.handler.handle(process=pacman.install_as_process(pkgpaths=to_install, - root_password=context.root_password, - file=context.has_install_file(), - pkgdir=context.project_dir), - output_handler=status_handler.handle if status_handler else None) + installed, _ = context.handler.handle_simple(pacman.install_as_process(pkgpaths=to_install, + root_password=context.root_password, + file=context.has_install_file(), + pkgdir=context.project_dir), + output_handler=status_handler.handle if status_handler else None) if status_handler: status_handler.stop_working() status_handler.join() diff --git a/bauh/gems/arch/pacman.py b/bauh/gems/arch/pacman.py index a6777cb6..df85427e 100644 --- a/bauh/gems/arch/pacman.py +++ b/bauh/gems/arch/pacman.py @@ -135,13 +135,13 @@ def map_installed(repositories: bool = True, aur: bool = True) -> dict: # retur return pkgs -def install_as_process(pkgpaths: Iterable[str], root_password: str, file: bool, pkgdir: str = '.') -> SystemProcess: +def install_as_process(pkgpaths: Iterable[str], root_password: str, file: bool, pkgdir: str = '.') -> SimpleProcess: if file: cmd = ['pacman', '-U', *pkgpaths, '--noconfirm'] # pkgpath = install file path else: cmd = ['pacman', '-S', *pkgpaths, '--noconfirm'] # pkgpath = pkgname - return SystemProcess(new_root_subprocess(cmd, root_password, cwd=pkgdir), wrong_error_phrase='warning:') + return SimpleProcess(cmd=cmd, root_password=root_password, cwd=pkgdir) def list_desktop_entries(pkgnames: Set[str]) -> List[str]: