首页 > 代码库 > python 子进程超时退出

python 子进程超时退出

一:循环 忙等 子进程结束import subprocess  import os  import time  tt = 555  cmd = "python /home/100003/python/mypython/sub2.py "+" 333"+" 444 "+tt  print time.time()  sub2 = subprocess.Popen(cmd, shell=True)  while 1:      ret1 = subprocess.Popen.poll(sub2)      if ret1 == 0:          print sub2.pid,end          break      elif ret1 is None:          print  running          time.sleep(1)      else:          print sub2.pid,term          break  print time.time()  

 

python 子进程超时退出