Skip to content

Commit 82fb204

Browse files
move to fixed temp dir. Add debug log
1 parent c79f4b8 commit 82fb204

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

base/file.jl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,8 +281,11 @@ function rm(path::AbstractString; force::Bool=false, recursive::Bool=false)
281281
if err.code==Base.UV_EACCES && endswith(path, ".dll")
282282
# Loaded DLLs cannot be deleted on Windows, even with posix delete mode
283283
# but they can be moved. So move out to allow the dir to be deleted
284-
# and DLL deleted via the temp dir cleanup on next reboot
285-
mv(path, tempname() * "_" * basename(path))
284+
# TODO: Add a mechanism to delete these moved files after dlclose or process exit
285+
dir = mkpath(joinpath(tempdir(), "julia_delayed_deletes"))
286+
temp_path = tempname(dir, cleanup = false) * "_" * basename(path)
287+
@debug "Could not delete DLL most likely because it is loaded, moving to tempdir" path temp_path
288+
mv(path, temp_path)
286289
end
287290
end
288291
end

0 commit comments

Comments
 (0)