解决adb shell top 获取的进程名不全问题
python 通过 os.system(adb shell top)获取的进程名不全(com.xxx.roc+)
平台: Mac
一、问题
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/4389240f76a5aff69cd0217dbc17a8c8.png)
二、调试
-
进入adb shell,再输入top,正常显示
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/55be6ad9a091ada471294543c9c8e59f.png)
-
原因
“adb shell top”命令在一个宽度为80的的虚拟终端中输出,top主动截断了超过宽度的字符。
进入adb shell终端中输出,正常。
三、解决方案
使用"COLUMNS"环境变量来指定虚拟终端宽度,即,“COLUMNS=512”。
adb shell COLUMNS=512 top