Dont print "done" when doing nothing

This commit is contained in:
Kovid Goyal
2019-07-08 07:36:30 +05:30
parent 0fc6c47556
commit e00e6bd1c2

View File

@@ -385,6 +385,7 @@ def parallel_run(items):
elif compile_cmd.on_success is not None: elif compile_cmd.on_success is not None:
compile_cmd.on_success() compile_cmd.on_success()
printed = False
while items and failed is None: while items and failed is None:
while len(workers) < num_workers and items: while len(workers) < num_workers and items:
compile_cmd = items.pop() compile_cmd = items.pop()
@@ -393,12 +394,13 @@ def parallel_run(items):
print(' '.join(compile_cmd.cmd)) print(' '.join(compile_cmd.cmd))
else: else:
print('\r\x1b[K[{}/{}] {}'.format(num, total, compile_cmd.desc), end='') print('\r\x1b[K[{}/{}] {}'.format(num, total, compile_cmd.desc), end='')
printed = True
w = subprocess.Popen(compile_cmd.cmd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT) w = subprocess.Popen(compile_cmd.cmd, stdout=subprocess.DEVNULL, stderr=subprocess.STDOUT)
workers[w.pid] = compile_cmd, w workers[w.pid] = compile_cmd, w
wait() wait()
while len(workers): while len(workers):
wait() wait()
if not verbose: if not verbose and printed:
print(' done') print(' done')
if failed: if failed:
print(failed.desc) print(failed.desc)