Skip to content

Commit 353e129

Browse files
authored
Pass force=true option to rename in case of loading failure in compilecache (#36638)
This seems to be affecting Windows systems in particular
1 parent 35f120f commit 353e129

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

base/file.jl

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -890,12 +890,11 @@ function unlink(p::AbstractString)
890890
end
891891

892892
# For move command
893-
function rename(src::AbstractString, dst::AbstractString)
893+
function rename(src::AbstractString, dst::AbstractString; force::Bool=false)
894894
err = ccall(:jl_fs_rename, Int32, (Cstring, Cstring), src, dst)
895895
# on error, default to cp && rm
896896
if err < 0
897-
# force: is already done in the mv function
898-
cp(src, dst; force=false, follow_symlinks=false)
897+
cp(src, dst; force=force, follow_symlinks=false)
899898
rm(src; recursive=true)
900899
end
901900
nothing

base/loading.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1338,7 +1338,7 @@ function compilecache(pkg::PkgId, path::String)
13381338
chmod(tmppath, filemode(path) & 0o777)
13391339

13401340
# this is atomic according to POSIX:
1341-
rename(tmppath, cachefile)
1341+
rename(tmppath, cachefile; force=true)
13421342
return cachefile
13431343
end
13441344
finally

0 commit comments

Comments
 (0)