p = subprocess.Popen("exec " +runcmd, stdout=subprocess.PIPE, shell=True)
while p.poll() == None:
#while True:
output = p.stdout.readline()
print (output)
if output == '' and p.poll is not None:
break
if output:
str = output.strip()
if '"Activate"' in str:
print ("pause initiated")
这里当stdout / output在日志中找到Activate我想暂停脚本但是它们的子进程执行必须继续指定的时间??如果我错了,请帮助并纠正我
我仍然不是100%确定你在寻找什么但是以下脚本:
exec
)"Activate"
(或者在程序结束之前停止,qzxswpoi调用已经正确).poll()