def start(self):
WorkerClient.stop_worker = False
node_path = global_vars.get_node_path()
if os.name == "nt":
si = subprocess.STARTUPINFO()
si.dwFlags |= subprocess.SW_HIDE | subprocess.STARTF_USESHOWWINDOW
self.server_proc = subprocess.Popen(
[node_path, self.script_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE, startupinfo=si
)
else:
self.server_proc = subprocess.Popen(
[node_path, self.script_path], stdin=subprocess.PIPE, stdout=subprocess.PIPE)
# start reader thread
if self.server_proc and (not self.server_proc.poll()):
log.debug("worker proc " + str(self.server_proc))
log.debug("starting worker thread")
workerThread = threading.Thread(target=WorkerClient.__reader, args=(
self.server_proc.stdout, self.msgq, self.eventq, self.asyncReq, self.server_proc, self.event_handlers))
workerThread.daemon = True
workerThread.start()
评论列表
文章目录