Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(269)

Unified Diff: devil/devil/android/tools/device_recovery.py

Issue 2491493003: [Devil] Attempt to reboot via sysrq even if root fails. (Closed)
Patch Set: [Devil] Attempt to reboot via sysrq even if root fails. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: devil/devil/android/tools/device_recovery.py
diff --git a/devil/devil/android/tools/device_recovery.py b/devil/devil/android/tools/device_recovery.py
index 7990e3de05b2e36080ef0bae0657f91e5cb46ad5..57857b1ed15160a90b9b6de82ab99195cc6f1dd5 100755
--- a/devil/devil/android/tools/device_recovery.py
+++ b/devil/devil/android/tools/device_recovery.py
@@ -75,9 +75,14 @@ def RecoverDevice(device, blacklist, should_reboot=lambda device: True):
'Attempting alternative reboot.', str(device))
# The device drops offline before we can grab the exit code, so
# we don't check for status.
- device.adb.Root()
- device.adb.Shell('echo b > /proc/sysrq-trigger', expect_status=None,
- timeout=5, retries=0)
+ try:
+ device.adb.Root()
+ finally:
+ # We are already in a failure mode, attempt to reboot regardless of
+ # what device.adb.Root() returns. If the sysrq reboot fails an
+ # exception willbe thrown at that level.
+ device.adb.Shell('echo b > /proc/sysrq-trigger', expect_status=None,
+ timeout=5, retries=0)
except device_errors.CommandFailedError:
logger.exception('Failed to reboot %s.', str(device))
if blacklist:
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698