Android adb等待设备超时/非阻塞?
调用“adb等待设备”时是否有超时的方法 情景:Android adb等待设备超时/非阻塞?,android,timeout,adb,nonblocking,Android,Timeout,Adb,Nonblocking,调用“adb等待设备”时是否有超时的方法 情景: adb reboot adb wait-for-devices (timeout listed here - if possible) **if times out: echo timed out** **else** adb root adb wait-for-devices 这个问题的目的是为了自动化,所以我找到了一个使用Perl的报警功能的临时解决方案: sub ADB_Wait_Timeout { eval {
adb reboot
adb wait-for-devices (timeout listed here - if possible)
**if times out: echo timed out**
**else**
adb root
adb wait-for-devices
这个问题的目的是为了自动化,所以我找到了一个使用Perl的报警功能的临时解决方案:
sub ADB_Wait_Timeout
{
eval
{
local $SIG{ALRM} = sub { die "Timeout\n" };
alarm 60;
system("adb wait-for-devices");
alarm 0;
};
if ($@)
{
print "Device did not come up\n";
}
}
关于如何使用超时进行系统调用,也有类似的答案:
在Bash中
timeout <time_in_seconds> adb wait-for-any-device
我在终端中尝试过:``超时2 adb-s 1234567891234等待设备``我等待一个不存在序列号的设备,它应该是超时。但我没有得到任何输出在终端与上述命令。
timeout 40 adb wait-for-any-device