Skip to content

Commit

Permalink
Use Atomic writes when binding artifacts
Browse files Browse the repository at this point in the history
This ensures that the inode of the underlying `Artifacts.toml` file gets
changed, which should properly invalidate Base's TOML cache.
  • Loading branch information
staticfloat committed Oct 24, 2022
1 parent d5d6470 commit 96ac41b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,11 @@ function bind_artifact!(artifacts_toml::String, name::String, hash::SHA1;

# Spit it out onto disk
let artifact_dict = artifact_dict
open(artifacts_toml, "w") do io
temp_artifacts_toml = tempname(dirname(artifacts_toml))
open(temp_artifacts_toml, "w") do io
TOML.print(io, artifact_dict, sorted=true)
end
mv(temp_artifacts_toml, artifacts_toml; force=true)
end

# Mark that we have used this Artifact.toml
Expand Down

0 comments on commit 96ac41b

Please sign in to comment.