Skip to content

Commit a633fc5

Browse files
authored
Use run for lsblk command (#4654)
1 parent 6dff852 commit a633fc5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

archinstall/lib/disk/utils.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
from pathlib import Path
2+
from subprocess import CalledProcessError
23

34
from pydantic import BaseModel
45

5-
from archinstall.lib.command import SysCommand
6+
from archinstall.lib.command import SysCommand, run
67
from archinstall.lib.exceptions import DiskError, SysCallError
78
from archinstall.lib.log import debug, info, warn
89
from archinstall.lib.models.device import LsblkInfo
@@ -29,19 +30,18 @@ def _fetch_lsblk_info(
2930
cmd.append(str(dev_path))
3031

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

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

4142
raise err
4243

43-
output = worker.output(remove_cr=False)
44-
return LsblkOutput.model_validate_json(output)
44+
return LsblkOutput.model_validate_json(result.stdout)
4545

4646

4747
def get_lsblk_info(

0 commit comments

Comments
 (0)