- 论坛徽章:
- 0
|
本帖最后由 zhjwlgh01 于 2017-06-10 14:54 编辑
新人,想写个小脚本调用linux的脚本,但总是拿不到output的结果,求教~~感觉问题出在 p.stdout.readlines()特别说明下,那个脚本大概要运行20分钟,理论上有大量的输出的
testCommand = "adb shell su -c '/data/con.sh'"
p=subprocess.Popen(testCommand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
while True:
buff = p.stdout.readlines();
count = count + 1
print str(count) + " : " + comm
if buff.find("---Test finished---") >= 0:
print buff,
return 0
elif buff.find("adb: error") >= 0:
print buff,
return 1
if p.poll() != None:
break;
time.sleep(60);
if (count > sleepTime):
print "executeCommand time out";
return 1;
|
|