import subprocess
import os
import signal
p = subprocess.Popen("recordmydesktop -o /home/test/test2.ogv",stdin = subprocess.PIPE,stdout = subprocess.PIPE,stderr = subprocess.PIPE,shell = True")
'''
参考:http://www.oschina.net/question/234345_52660
http://blog.csdn.net/JGood/archive/2009/08/29/4498166.aspx
'''
if p.poll() is None:
p.terminate()
p.wait()
#结束掉上面启动的进程
subprocess模块中只定义 了一个类: Popen。可以使用Popen来创建进程,并与进程进行复杂的交互。它的构造函数如下:
subprocess.Popen(args, bufsize=0, executable=None, stdin=