diff --git a/archinstall/lib/disk/utils.py b/archinstall/lib/disk/utils.py index 5d25c2f8..1fce6f48 100644 --- a/archinstall/lib/disk/utils.py +++ b/archinstall/lib/disk/utils.py @@ -32,9 +32,8 @@ def _fetch_lsblk_info( worker = SysCommand(cmd) except SysCallError as err: # Get the output minus the message/info from lsblk if it returns a non-zero exit code. - if err.worker: - err_str = err.worker.decode() - debug(f'Error calling lsblk: {err_str}') + if err.worker_log: + debug(f'Error calling lsblk: {err.worker_log.decode()}') if dev_path: raise DiskError(f'Failed to read disk "{dev_path}" with lsblk') diff --git a/archinstall/lib/exceptions.py b/archinstall/lib/exceptions.py index e7209aaf..f398b224 100644 --- a/archinstall/lib/exceptions.py +++ b/archinstall/lib/exceptions.py @@ -1,9 +1,3 @@ -from typing import TYPE_CHECKING - -if TYPE_CHECKING: - from .general import SysCommandWorker - - class RequirementError(Exception): pass @@ -17,11 +11,11 @@ class UnknownFilesystemFormat(Exception): class SysCallError(Exception): - def __init__(self, message: str, exit_code: int | None = None, worker: 'SysCommandWorker | None' = None) -> None: + def __init__(self, message: str, exit_code: int | None = None, worker_log: bytes = b'') -> None: super().__init__(message) self.message = message self.exit_code = exit_code - self.worker = worker + self.worker_log = worker_log class HardwareIncompatibilityError(Exception): diff --git a/archinstall/lib/general.py b/archinstall/lib/general.py index f83a86be..4221be5f 100644 --- a/archinstall/lib/general.py +++ b/archinstall/lib/general.py @@ -205,7 +205,7 @@ class SysCommandWorker: raise SysCallError( f"{self.cmd} exited with abnormal exit code [{self.exit_code}]: {str(self)[-500:]}", self.exit_code, - worker=self + worker_log=self._trace_log ) def is_alive(self) -> bool: diff --git a/archinstall/lib/installer.py b/archinstall/lib/installer.py index 89129885..63b43cab 100644 --- a/archinstall/lib/installer.py +++ b/archinstall/lib/installer.py @@ -759,8 +759,8 @@ class Installer: SysCommand(f'arch-chroot {self.target} mkinitcpio {" ".join(flags)}', peek_output=True) return True except SysCallError as e: - if e.worker: - log(e.worker._trace_log.decode()) + if e.worker_log: + log(e.worker_log.decode()) return False def _get_microcode(self) -> Path | None: