【发布时间】:2015-06-01 17:03:00
【问题描述】:
我在 Python2.7 中使用 sub.Popen
但是,Python3有超时,Python2.7不行。
这是我的sn-p。
proc = sub.Popen(['some command', 'some params'], stdout=sub.PIPE)
try:
for row in proc.stdout:
print row.rstrip() # process here
result = str(row.rstrip())
count += 1
if count > 10:
break
except:
print 'tcpdump error'
proc.terminate()
如何设置超时。
【问题讨论】: