From 8a266f914956fb5231dea38db601766ff3acb6dc Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Fri, 6 Jan 2023 04:37:23 +0100 Subject: [PATCH] image/fastboot: use exec.cmd.run_cmd() for loggability --- image/fastboot.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/image/fastboot.py b/image/fastboot.py index d8816bf..937b348 100644 --- a/image/fastboot.py +++ b/image/fastboot.py @@ -1,12 +1,12 @@ import logging -import subprocess +from exec.cmd import run_cmd, CompletedProcess from typing import Optional def fastboot_erase_dtbo(): logging.info("Fastboot: Erasing DTBO") - subprocess.run( + run_cmd( [ 'fastboot', 'erase', @@ -18,23 +18,25 @@ def fastboot_erase_dtbo(): def fastboot_flash(partition: str, file: str, sparse_size: Optional[str] = None): logging.info(f"Fastboot: Flashing {file} to {partition}") - result = subprocess.run([ + result = run_cmd([ 'fastboot', *(['-S', sparse_size] if sparse_size is not None else []), 'flash', partition, file, ]) + assert isinstance(result, CompletedProcess) if result.returncode != 0: raise Exception(f'Failed to flash {file}') def fastboot_boot(file): logging.info(f"Fastboot: booting {file}") - result = subprocess.run([ + result = run_cmd([ 'fastboot', 'boot', file, ]) + assert isinstance(result, CompletedProcess) if result.returncode != 0: raise Exception(f'Failed to boot {file} using fastboot')