Python kill process
来源:互联网 发布:js的多级联动下拉菜单 编辑:程序博客网 时间:2024/06/07 11:45
import osimport threadingimport timeimport subprocessclass R(threading.Thread): def __init__(self, cmd): threading.Thread.__init__(self) self.cmd = cmd self.flag = False self.pro = subprocess.Popen(self.cmd) def setFlag(self, f): self.flag = f def run(self): while True: if self.pro == None: break elif self.flag: self.pro.kill() break def p(cmd): #t = os.popen(cmd).read() t = subprocess.Popen(['java', 'T']) print t def f(): t1 = time.time() print '0000000000' t = threading.Thread(target=p, args=('java T',)) t.start() print '1111111111' time.sleep(2) t2 = time.time() t0 = t2 - t1 def f2(): cmd = ['java', 'T'] r = R(cmd) r.start() time.sleep(2) r.setFlag(True)if __name__ == '__main__': f2()
- Python kill process
- python kill process by name
- Kill Process
- kill process
- kill process
- kill process
- Kill Process
- Linux kill a process
- kill Oracle process
- linux kill process
- linux kill children process
- Android Kill Process
- mysql---kill process
- kill process in linux
- 582. Kill Process Medium
- [leetcode] 582. Kill Process
- leetcode 582.Kill Process
- 如何KILL<defunct> process
- 将手机网站做成手机应用的JS框架
- SphinxClient 类
- C/C++: static
- MFC 虚拟键码对照表
- leetcode:Minimum Depth of Binary Tree(树的根节点到叶子节点的最小距离)【面试算法题】
- Python kill process
- mount failed: reason given by the server: Permission Denied
- Spring中使用classpath加载配置文件浅析
- DM9000A网卡芯片介绍
- activity+service通信
- 一步步教你交叉编译嵌入式linux GUI-directfb+gtk
- C语言指针方面的理解:(更新中)位对齐
- Android SDK下载和更新失败的解决方法!!!
- Failed to load libGL.so error libGL.so: cannot open shared object file: No such file or directory