def start(self, start_queue=False, shell=False):
if not self.proc:
logging.info("Starting Engine " + self.name)
try:
self.start_loading()
self.proc=Popen(self.command,shell=shell,bufsize=1,universal_newlines=True,
stdin=PIPE,stdout=PIPE,stderr=STDOUT,env=self.command_env)
#, preexec_fn=os.setsid
#, preexec_fn=self.chuser()
if start_queue:
self.queue=Queue()
self.thread_queue=Thread(target=self.proc_enqueue_output, args=())
self.thread_queue.daemon = True # thread dies with the program
self.thread_queue.start()
self.proc_get_lines(2)
except Exception as err:
logging.error("Can't start engine %s => %s" % (self.name,err))
self.stop_loading()
评论列表
文章目录