adb - windows上是否有任何adb等待设备超时方法
问题描述
我想使用限时 adb wait-for-device ,但似乎没有超时功能,我的解决方法如下,有没有更有效的方法来实现它?
<python on Windows>
t0 = datetime.datetime.now()
cmd = 'date'
cmd = 'adb -s %s shell \"'+ cmd+ '\"'
r = 1
while(r!=0 and (t1-t0).seconds < 60):
r = os.system(cmd)
t1 = datetime.datetime.now()
解决方案
没有可用的特定超时方法,但您可以尝试
def wait_for_device(self, timeout=5):
"""
Perform `adb wait-for-device` command
Args:
timeout: time interval in seconds to wait for device
Raises:
DeviceConnectionError: if device is not available after timeout
Returns:
None
"""
try:
self.cmd("wait-for-device", timeout=timeout)
except RuntimeError as e:
raisefrom(DeviceConnectionError, "device not ready", e)
推荐阅读
- r - 通过包have R读取sas元数据文件时出错
- python - 如何通过 json 将 OpenCV-Image 发送到 Flask Docker-Container?
- java - 通过 RMI 传输 Java 文件
- python - 在反向代理后面加前缀 url_for()
- xml - CSV 到 XML XSLT:如何通过管道转义
- c# - 即使未使用属性,也会调用自定义授权属性
- php - 多维数组到 HTML 表
- pointers - 当我将变量传递给golang中的私有方法时,它会创建一个新实例吗?
- angular - 带有编译器检查的 ViewChild 绑定
- haskell - 具有某种函数头问题的 Haskell 数据构造函数?