We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cdb5683 commit 9647bd1Copy full SHA for 9647bd1
openandroidinstaller/tooling.py
@@ -181,9 +181,14 @@ def adb_twrp_format_data(bin_path: Path) -> TerminalResponse:
181
182
If `format data` fails (for example because of old TWRP versions) we fall back to `wipe data`.
183
"""
184
+ unknown_command = False
185
for line in run_command("adb shell twrp format data", bin_path):
186
+ if "Unrecognized script command" in line:
187
+ unknown_command = True
188
yield line
- if (type(line) == bool) and not line:
189
+
190
+ # if it fails because the command is unknown, retry with wipe data.
191
+ if unknown_command:
192
logger.info(
193
"Factory reset with `adb twrp format data` failed. Trying `adb twrp wipe data` now."
194
)
0 commit comments