mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
Ignore remote devices by default, use -R or --allow-remote to override.
This commit is contained in:
parent
a996d97681
commit
55d27364a2
2 changed files with 21 additions and 1 deletions
|
@ -117,6 +117,12 @@ module.exports = function(options) {
|
|||
return device.id === '????????????'
|
||||
}
|
||||
|
||||
// Check whether the device is remote (i.e. if we're connecting to
|
||||
// an IP address (or hostname) and port pair).
|
||||
function isRemoteDevice(device) {
|
||||
return device.id.indexOf(':') !== -1
|
||||
}
|
||||
|
||||
// Helper for ignoring unwanted devices
|
||||
function filterDevice(listener) {
|
||||
return function(device) {
|
||||
|
@ -124,6 +130,13 @@ module.exports = function(options) {
|
|||
log.warn('ADB lists a weird device: "%s"', device.id)
|
||||
return false
|
||||
}
|
||||
if (!options.allowRemote && isRemoteDevice(device)) {
|
||||
log.info(
|
||||
'Filtered out remote device "%s", use --allow-remote to override'
|
||||
, device.id
|
||||
)
|
||||
return false
|
||||
}
|
||||
if (options.filter && !options.filter(device)) {
|
||||
log.info('Filtered out device "%s"', device.id)
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue