Skip to content
Snippets Groups Projects
Commit bbe7ad0c authored by Fabrice Le Goff's avatar Fabrice Le Goff
Browse files

fix crash if file removed by external

parent b8b1716d
No related branches found
No related tags found
No related merge requests found
Pipeline #
...@@ -239,8 +239,19 @@ class ManagerThread(threading.Thread): ...@@ -239,8 +239,19 @@ class ManagerThread(threading.Thread):
# end if # end if
### Check for minimal file size, if needed ### Check for minimal file size, if needed
try:
filesize = os.path.getsize(filename)
except OSError as exc:
if exc.errno == errno.ENOENT:
# The file has been removed by an external cause.
# This is bad but this is not a reason to crash.
self.logger.critical('error getting file size for %s: not present (deleted by external cause)', filename)
continue
else:
raise exc
if self.MinSizekB and \ if self.MinSizekB and \
os.path.getsize(filename)/1024.< self.MinSizekB: filesize/1024.< self.MinSizekB:
self.logger.debug('File %s is too small. Skipping.', filename) self.logger.debug('File %s is too small. Skipping.', filename)
if self.RemoveSmallFiles: if self.RemoveSmallFiles:
self.logger.debug('File %s is too small. Deleting.', filename) self.logger.debug('File %s is too small. Deleting.', filename)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment