From cdb56833f304d77d03ff555052d0d5999b6a9c84 Mon Sep 17 00:00:00 2001 From: Tobias Sterbak Date: Mon, 24 Apr 2023 12:13:33 +0200 Subject: [PATCH] Run the retry in the correct function... --- openandroidinstaller/tooling.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/openandroidinstaller/tooling.py b/openandroidinstaller/tooling.py index 69279217..9e700ce6 100644 --- a/openandroidinstaller/tooling.py +++ b/openandroidinstaller/tooling.py @@ -177,18 +177,11 @@ def adb_twrp_copy_partitions(bin_path: Path, config_path: Path) -> TerminalRespo @add_logging("Perform a factory reset with adb and twrp.", return_if_fail=True) def adb_twrp_format_data(bin_path: Path) -> TerminalResponse: - """Perform a factory reset with twrp and adb.""" - for line in run_command("adb shell twrp format data", bin_path): - yield line - - -@add_logging("Wipe the selected partition with adb and twrp.", return_if_fail=True) -def adb_twrp_wipe_partition(bin_path: Path, partition: str) -> TerminalResponse: """Perform a factory reset with twrp and adb. If `format data` fails (for example because of old TWRP versions) we fall back to `wipe data`. """ - for line in run_command(f"adb shell twrp wipe {partition}", bin_path): + for line in run_command("adb shell twrp format data", bin_path): yield line if (type(line) == bool) and not line: logger.info( @@ -199,6 +192,13 @@ def adb_twrp_wipe_partition(bin_path: Path, partition: str) -> TerminalResponse: yield line +@add_logging("Wipe the selected partition with adb and twrp.", return_if_fail=True) +def adb_twrp_wipe_partition(bin_path: Path, partition: str) -> TerminalResponse: + """Perform a factory reset with twrp and adb.""" + for line in run_command(f"adb shell twrp wipe {partition}", bin_path): + yield line + + def adb_twrp_wipe_and_install( bin_path: Path, target: str,