Add the option to suppress or not exceptions during deletion
This commit is contained in:
@@ -454,11 +454,14 @@ def load_backend(backend_string):
|
|||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
def fs_cleanup(filename):
|
def fs_cleanup(filename, suppress_exceptions=True):
|
||||||
"""
|
"""
|
||||||
Tries to remove the given filename. Ignores non-existent files
|
Tries to remove the given filename. Ignores non-existent files
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
os.remove(filename)
|
os.remove(filename)
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
if suppress_exceptions:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise
|
||||||
|
|||||||
Reference in New Issue
Block a user