以下命令在通过终端运行时工作正常。
adb -s 192.168.100.101:5555 shell tcpdump -nnvvettU -s 0 -i eth1 > dump.txt
但是当我尝试从python脚本运行它时,它尝试在模拟器上写入,如下所示:
#Python script:
cmd_str = "adb -s 192.168.100.101:5555 shell tcpdump -nnvvettU -s 0 -i eth1 > dump.txt"
cmd = cmd_str.split()
call(cmd)
#Error:
/system/bin/sh: can't create dump.txt: Read-only file system
那么如何在主机系统上编写文件而不是python脚本中的模拟器呢?