Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions archinstall/lib/disk/utils.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from pathlib import Path
from subprocess import CalledProcessError

from pydantic import BaseModel

from archinstall.lib.command import SysCommand
from archinstall.lib.command import SysCommand, run
from archinstall.lib.exceptions import DiskError, SysCallError
from archinstall.lib.log import debug, info, warn
from archinstall.lib.models.device import LsblkInfo
Expand All @@ -29,19 +30,18 @@ def _fetch_lsblk_info(
cmd.append(str(dev_path))

try:
worker = SysCommand(cmd)
except SysCallError as err:
result = run(cmd)
except CalledProcessError as err:
# Get the output minus the message/info from lsblk if it returns a non-zero exit code.
if err.worker_log:
debug(f'Error calling lsblk: {err.worker_log.decode()}')
if stdout := err.stdout:
debug(f'Error calling lsblk: {stdout.decode().rstrip()}')

if dev_path:
raise DiskError(f'Failed to read disk "{dev_path}" with lsblk')

raise err

output = worker.output(remove_cr=False)
return LsblkOutput.model_validate_json(output)
return LsblkOutput.model_validate_json(result.stdout)


def get_lsblk_info(
Expand Down