Skip to content

Commit b713441

Browse files
authored
Fix use of Base.rename for 1.12 (#613)
1 parent 6927945 commit b713441

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/execution.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,18 @@ end
244244
@static if VERSION >= v"1.11.0-"
245245
if !ondisk_hit && path !== nothing && disk_cache_enabled()
246246
@debug "Writing out on-disk cache" job path
247-
tmppath, io = mktemp(;cleanup=false)
247+
mkpath(dirname(path))
248248
entry = DiskCacheEntry(src.specTypes, cfg, asm)
249+
250+
# atomic write to disk
251+
tmppath, io = mktemp(dirname(path); cleanup=false)
249252
serialize(io, entry)
250253
close(io)
251-
# atomic move
252-
mkpath(dirname(path))
253-
Base.rename(tmppath, path, force=true)
254+
@static if VERSION >= v"1.12.0-DEV.1023"
255+
mv(tmppath, path; force=true)
256+
else
257+
Base.rename(tmppath, path, force=true)
258+
end
254259
end
255260
end
256261

src/rtlib.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,11 @@ const runtime_lock = ReentrantLock()
153153
temp_path, io = mktemp(dirname(path); cleanup=false)
154154
write(io, lib)
155155
close(io)
156-
Base.rename(temp_path, path; force=true)
156+
@static if VERSION >= v"1.12.0-DEV.1023"
157+
mv(temp_path, path; force=true)
158+
else
159+
Base.rename(temp_path, path, force=true)
160+
end
157161
end
158162

159163
return lib

0 commit comments

Comments
 (0)