mirror of
https://github.com/codingo/Interlace.git
synced 2025-12-17 06:44:23 +01:00
Changed to ensure Interlace waits for the thread to finish
This commit is contained in:
@@ -47,23 +47,24 @@ class Task(object):
|
|||||||
return self.self_lock
|
return self.self_lock
|
||||||
|
|
||||||
def _run_task(self, t=False):
|
def _run_task(self, t=False):
|
||||||
if t:
|
|
||||||
s = subprocess.Popen(self.task, shell=True,
|
s = subprocess.Popen(self.task, shell=True,
|
||||||
stdout=subprocess.PIPE,
|
stdout=subprocess.PIPE,
|
||||||
encoding="utf-8")
|
encoding="utf-8")
|
||||||
out, _ = s.communicate()
|
out, _ = s.communicate()
|
||||||
|
|
||||||
if out != "":
|
if out != "":
|
||||||
|
if t:
|
||||||
t.write(out)
|
t.write(out)
|
||||||
else:
|
else:
|
||||||
subprocess.Popen(self.task, shell=True)
|
print(out)
|
||||||
|
|
||||||
|
|
||||||
class Worker(object):
|
class Worker(object):
|
||||||
def __init__(self, task_queue, timeout, output, tqdm):
|
def __init__(self, task_queue, timeout, output, tq):
|
||||||
self.queue = task_queue
|
self.queue = task_queue
|
||||||
self.timeout = timeout
|
self.timeout = timeout
|
||||||
self.output = output
|
self.output = output
|
||||||
self.tqdm = tqdm
|
self.tqdm = tq
|
||||||
|
|
||||||
def __call__(self):
|
def __call__(self):
|
||||||
queue = self.queue
|
queue = self.queue
|
||||||
|
|||||||
Reference in New Issue
Block a user