Skip to content

Commit d486481

Browse files
author
Kevin D Smith
committed
Rework error handling in temp dirs
1 parent 2066839 commit d486481

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cicd/tar2conda.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,10 @@ def __enter__(self):
185185

186186
def __exit__(self, exc_type, exc_value, traceback):
187187
import atexit
188-
atexit.register(shutil.rmtree, self.dir_name)
188+
def onerror(func, path, excinfo):
189+
''' Error function for rmtree '''
190+
print_err('WARNING: Could not remove file %s.' % path)
191+
atexit.register(shutil.rmtree, self.dir_name, onerror=onerror)
189192

190193

191194
@contextlib.contextmanager

0 commit comments

Comments
 (0)