def __init__(self, command, **kwds):
"""Creates a new instance that monitors subprocess.Popen(/command/), the created process starts in a paused state.
Keyword options:
env<dict> = os.environ -- environment to execute program with
cwd<str> = os.getcwd() -- directory to execute program in
shell<bool> = True -- whether to treat program as an argument to a shell, or a path to an executable
newlines<bool> = True -- allow python to tamper with i/o to convert newlines
show<bool> = False -- if within a windowed environment, open up a console for the process.
paused<bool> = False -- if enabled, then don't start the process until .start() is called
timeout<float> = -1 -- if positive, then raise a Queue.Empty exception at the specified interval.
"""
# default properties
self.__updater = None
self.__threads = weakref.WeakSet()
self.__kwds = kwds
self.commandline = command
import Queue
self.eventWorking = threading.Event()
self.__taskQueue = Queue.Queue()
self.__exceptionQueue = Queue.Queue()
self.stdout = kwds.pop('stdout')
self.stderr = kwds.pop('stderr')
# start the process
not kwds.get('paused',False) and self.start(command)
评论列表
文章目录