From 4c44f7fec2a054f8b822cc779bb1e8a5745dcbea Mon Sep 17 00:00:00 2001 From: Mike McLean Date: Mon, 1 Jun 2009 17:17:36 -0400 Subject: [PATCH] avoid duplicate waits on mock --- builder/kojid | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/builder/kojid b/builder/kojid index 3e27f472..3882b7bc 100755 --- a/builder/kojid +++ b/builder/kojid @@ -384,9 +384,12 @@ class BuildRoot(object): uploadpath = self.getUploadPath() logs = {} - while True: + finished = False + while not finished: time.sleep(1) status = os.waitpid(pid, os.WNOHANG) + if status[0] != 0: + finished = True try: results = os.listdir(resultdir) @@ -418,12 +421,11 @@ class BuildRoot(object): continue incrementalUpload(fname, fd, uploadpath, self.logger) - - if status[0] != 0: - for (fname, (fd, inode, size)) in logs.items(): - if fd: - fd.close() - return status[1] + #clean up and return exit status of command + for (fname, (fd, inode, size)) in logs.items(): + if fd: + fd.close() + return status[1] else: #in no case should exceptions propagate past here