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()
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