Merge "[hca] Join threads before closing file descriptor"

This commit is contained in:
Zuul 2020-06-03 10:28:19 +00:00 committed by Gerrit Code Review
commit 05f7ceea17
1 changed files with 7 additions and 2 deletions

View File

@ -87,9 +87,14 @@ def main(argv=sys.argv):
logger = dict(stdout=lambda line: log.info(line), logger = dict(stdout=lambda line: log.info(line),
stderr=lambda line: log.debug(line)) stderr=lambda line: log.debug(line))
with open(lp, 'w') as fd: with open(lp, 'w') as fd:
for label in ['stdout', 'stderr']: threads = []
threading.Thread(target=consumer, args=[label, fd]).start() for lb in ['stdout', 'stderr']:
t = threading.Thread(target=consumer, args=[lb, fd])
threads.append(t)
t.start()
deploy_status_code = subproc.wait() deploy_status_code = subproc.wait()
for t in threads:
t.join()
if deploy_status_code: if deploy_status_code:
log.error("Error running %s. [%s]\n" % (fn, deploy_status_code)) log.error("Error running %s. [%s]\n" % (fn, deploy_status_code))