Skip to content

Commit bf8f49e

Browse files
StefanKarpinskiKristofferC
authored andcommitted
temp cleanup: broaden try-catch block (#33996)
1 parent efa8bd9 commit bf8f49e

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

base/file.jl

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -480,15 +480,16 @@ end
480480
function temp_cleanup_purge(all::Bool=true)
481481
need_gc = Sys.iswindows()
482482
for (path, asap) in TEMP_CLEANUP
483-
if (all || asap) && ispath(path)
484-
need_gc && GC.gc(true)
485-
need_gc = false
486-
try rm(path, recursive=true, force=true)
487-
catch ex
488-
@warn "temp cleanup" _group=:file exception=(ex, catch_backtrace())
483+
try
484+
if (all || asap) && ispath(path)
485+
need_gc && GC.gc(true)
486+
need_gc = false
487+
rm(path, recursive=true, force=true)
489488
end
489+
!ispath(path) && delete!(TEMP_CLEANUP, path)
490+
catch ex
491+
@warn "temp cleanup" _group=:file exception=(ex, catch_backtrace())
490492
end
491-
!ispath(path) && delete!(TEMP_CLEANUP, path)
492493
end
493494
end
494495

0 commit comments

Comments
 (0)