summaryrefslogtreecommitdiff
path: root/scripts/update_device.py
diff options
context:
space:
mode:
authorKelvin Zhang <zhangkelvin@google.com>2021-04-13 12:44:45 -0400
committerKelvin Zhang <zhangkelvin@google.com>2021-04-15 12:44:22 -0400
commit3a18895c6facd86b97d8cd0b955a2ab61f02cde4 (patch)
treeea2b4f737e86082dcd589814929bc4b7c4b46217 /scripts/update_device.py
parentb7e6ce5f6acf3fb1b7bd6aae735e548acf61f07f (diff)
Add 5s timeout to cleanup commands
Sometimes shutdown takes a while due to adb issues, gracefully terminate with a timeout. This will throw an exception if timeout occured, telling the developer that something went wrong. Test: python3 update_device.py ota.zip Change-Id: I44edc6a291fc682b9439ab97f2880d47dc4e457b
Diffstat (limited to 'scripts/update_device.py')
-rwxr-xr-xscripts/update_device.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/scripts/update_device.py b/scripts/update_device.py
index b784b1bc..3ce40a55 100755
--- a/scripts/update_device.py
+++ b/scripts/update_device.py
@@ -350,7 +350,7 @@ class AdbHost(object):
if self._device_serial:
self._command_prefix += ['-s', self._device_serial]
- def adb(self, command):
+ def adb(self, command, timeout_seconds: float = None):
"""Run an ADB command like "adb push".
Args:
@@ -365,7 +365,7 @@ class AdbHost(object):
command = self._command_prefix + command
logging.info('Running: %s', ' '.join(str(x) for x in command))
p = subprocess.Popen(command, universal_newlines=True)
- p.wait()
+ p.wait(timeout_seconds)
return p.returncode
def adb_output(self, command):
@@ -546,7 +546,7 @@ def main():
if server_thread:
server_thread.StopServer()
for cmd in finalize_cmds:
- dut.adb(cmd)
+ dut.adb(cmd, 5)
return 0