avoid duplicate waits on mock

This commit is contained in:
Mike McLean 2009-06-01 17:17:36 -04:00
parent f4416e63c5
commit 4c44f7fec2

View file

@ -384,9 +384,12 @@ class BuildRoot(object):
uploadpath = self.getUploadPath() uploadpath = self.getUploadPath()
logs = {} logs = {}
while True: finished = False
while not finished:
time.sleep(1) time.sleep(1)
status = os.waitpid(pid, os.WNOHANG) status = os.waitpid(pid, os.WNOHANG)
if status[0] != 0:
finished = True
try: try:
results = os.listdir(resultdir) results = os.listdir(resultdir)
@ -418,12 +421,11 @@ class BuildRoot(object):
continue continue
incrementalUpload(fname, fd, uploadpath, self.logger) incrementalUpload(fname, fd, uploadpath, self.logger)
#clean up and return exit status of command
if status[0] != 0: for (fname, (fd, inode, size)) in logs.items():
for (fname, (fd, inode, size)) in logs.items(): if fd:
if fd: fd.close()
fd.close() return status[1]
return status[1]
else: else:
#in no case should exceptions propagate past here #in no case should exceptions propagate past here