mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 02:53:19 +02:00
Ignore remote devices by default, use -R or --allow-remote to override.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user