原始代码在这里
import subprocess as sp
cmd = ["adb","push","file","/mnt/sdcard/file"]
mysp = sp.popen(cmd, env={'ADB_TRACE':'adb'}, stdout=sp.PIPE, stderr=sp.PIPE)
stdout,stderr = mysp.communicate()
if mysp.returncode != 0:
print stderr
else:
print stdout
没有env={'ADB_TRACE':'adb'}
.
用 env 变量执行任何命令adb
,我得到一个错误:
ADB server didn't ACK
* failed to start daemon *
error: cannot connect to daemon
杀死 adb 服务器后似乎不起作用
整个输出在这里
操作系统:win7