Skip to content

Commit

Permalink
Run the retry in the correct function...
Browse files Browse the repository at this point in the history
  • Loading branch information
tsterbak committed Apr 24, 2023
1 parent a4aa74d commit cdb5683
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions openandroidinstaller/tooling.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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,
Expand Down

0 comments on commit cdb5683

Please sign in to comment.