Index: devil/devil/android/sdk/adb_wrapper.py |
diff --git a/devil/devil/android/sdk/adb_wrapper.py b/devil/devil/android/sdk/adb_wrapper.py |
index 5336c4899212331bfa5a746662a3aa78e7773577..fffcce84c887dd75e6a6075a8171f597d5b5e019 100644 |
--- a/devil/devil/android/sdk/adb_wrapper.py |
+++ b/devil/devil/android/sdk/adb_wrapper.py |
@@ -41,6 +41,7 @@ _DEVICE_NOT_FOUND_RE = re.compile(r"error: device '(?P<serial>.+)' not found") |
_READY_STATE = 'device' |
_VERITY_DISABLE_RE = re.compile(r'Verity (already )?disabled') |
_VERITY_ENABLE_RE = re.compile(r'Verity (already )?enabled') |
+_WAITING_FOR_DEVICE_RE = re.compile(r'- waiting for device -') |
def VerifyLocalFileExists(path): |
@@ -269,8 +270,10 @@ class AdbWrapper(object): |
# inconsistent with error reporting so many command failures present |
# differently. |
if status != 0 or (check_error and output.startswith('error:')): |
- m = _DEVICE_NOT_FOUND_RE.match(output) |
- if m is not None and m.group('serial') == device_serial: |
+ not_found_m = _DEVICE_NOT_FOUND_RE.match(output) |
+ device_waiting_m = _WAITING_FOR_DEVICE_RE.match(output) |
+ if device_waiting_m is not None or (not_found_m is not None and |
jbudorick
2017/08/19 00:22:13
nit: this would be a bit easier to read w/ the lin
bpastene
2017/08/19 00:50:31
Done.
|
+ not_found_m.group('serial') == device_serial): |
raise device_errors.DeviceUnreachableError(device_serial) |
else: |
raise device_errors.AdbCommandFailedError( |