Add the option to suppress or not exceptions during deletion

This commit is contained in:
Roberto Rosario
2014-07-08 15:42:24 -04:00
parent b430f08509
commit f911d06823

View File

@@ -454,11 +454,14 @@ def load_backend(backend_string):
raise
def fs_cleanup(filename):
def fs_cleanup(filename, suppress_exceptions=True):
"""
Tries to remove the given filename. Ignores non-existent files
"""
try:
os.remove(filename)
except OSError:
pass
if suppress_exceptions:
pass
else:
raise