Meituan-Dianping / lyrebird-android

本程序是一个Lyrebird的插件,用于支持获取Android设备信息。
MIT License
122 stars 45 forks source link

单个设备时,设备列表取值为空 #55

Closed yufengTester closed 3 years ago

yufengTester commented 3 years ago

def devices(): res = subprocess.run(f'{adb} devices -l', shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) output = res.stdout.decode() err_str = res.stderr.decode() online_devices = {}

# ADB command error
if res.returncode != 0:
    logger.error('Get devices list error' + err_str)
    return online_devices

lines = [line for line in output.split('\n') if line]
lines.remove("\r")  ------------加上后正常

if len(lines) > 1:
    for line in lines[1:]:
        device = Device.from_adb_line(line)
        online_devices[device.device_id] = device

return online_devices
yumiguan commented 3 years ago

Fixed in https://github.com/Meituan-Dianping/lyrebird-android/pull/56