Skip to content

Commit

Permalink
Fix use of Base.rename for 1.12 (#613)
Browse files Browse the repository at this point in the history
  • Loading branch information
nhz2 committed Aug 14, 2024
1 parent 6927945 commit b713441
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
13 changes: 9 additions & 4 deletions src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,13 +244,18 @@ end
@static if VERSION >= v"1.11.0-"
if !ondisk_hit && path !== nothing && disk_cache_enabled()
@debug "Writing out on-disk cache" job path
tmppath, io = mktemp(;cleanup=false)
mkpath(dirname(path))
entry = DiskCacheEntry(src.specTypes, cfg, asm)

# atomic write to disk
tmppath, io = mktemp(dirname(path); cleanup=false)
serialize(io, entry)
close(io)
# atomic move
mkpath(dirname(path))
Base.rename(tmppath, path, force=true)
@static if VERSION >= v"1.12.0-DEV.1023"
mv(tmppath, path; force=true)
else
Base.rename(tmppath, path, force=true)
end
end
end

Expand Down
6 changes: 5 additions & 1 deletion src/rtlib.jl
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ const runtime_lock = ReentrantLock()
temp_path, io = mktemp(dirname(path); cleanup=false)
write(io, lib)
close(io)
Base.rename(temp_path, path; force=true)
@static if VERSION >= v"1.12.0-DEV.1023"
mv(temp_path, path; force=true)
else
Base.rename(temp_path, path, force=true)
end
end

return lib
Expand Down

0 comments on commit b713441

Please sign in to comment.