Fix empty standard out behavior

Previously we could just check for the absence of the stdout file to
know we didn't yet/wouldn't ever have any stdout content.  Now that we
are creating the stdout file ahead of time and persisting it we need to
also check to see if the file contains any data.   This is also
necessary for some unit tests.
This commit is contained in:
Matthew Jones 2015-08-04 14:23:47 -04:00
parent 3a61896cb5
commit 7e45ee8b55

View File

@ -598,7 +598,7 @@ class UnifiedJob(PolymorphicModel, PasswordFieldsModel, CommonModelNameNotUnique
if self.result_stdout_text:
return StringIO(self.result_stdout_text)
else:
if not os.path.exists(self.result_stdout_file):
if not os.path.exists(self.result_stdout_file) or os.stat(self.result_stdout_file).st_size < 1:
return StringIO(msg['missing' if self.finished else 'pending'])
# There is a potential timing issue here, because another