Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

adb wait-for-devices timeout/nonblocking?

Is there a way to have a timeout when calling "adb wait-for-devices"?

Scenario:

adb reboot
adb wait-for-devices (timeout listed here - if possible)
**if times out: echo timed out**
**else**
adb root
adb wait-for-devices
like image 1000
Grayson Henry Avatar asked Mar 18 '23 21:03

Grayson Henry


1 Answers

In Bash,

timeout <time_in_seconds> adb wait-for-any-device

Ex: Below command waits for 40 seconds to scan for adb devices, and will return the exit code of the command, on success, or 124 on timeout, or exit code of command on command failure.

timeout 40 adb wait-for-any-device
like image 158
Sundeep471 Avatar answered Apr 11 '23 02:04

Sundeep471