I use a sub.Popen in Python2.7
But, Python3 has timeout but, Python2.7 can't it.
it is my snippet.
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()
How to set timeout to it.