Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions src/Artifacts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,16 @@ function _mv_temp_artifact_dir(temp_dir::String, new_path::String)::Nothing
# However, `mv` defaults to `cp` if `rename` returns an error.
# `cp` is not atomic, so avoid the potential of calling it.
err = ccall(:jl_fs_rename, Int32, (Cstring, Cstring), temp_dir, new_path)
# Ignore rename error, but ensure `new_path` exists.
if !isdir(new_path)
error("$(repr(new_path)) could not be made")
if err ≥ 0
# rename worked
chmod(new_path, filemode(dirname(new_path)))
set_readonly(new_path)
else
# Ignore rename error, if `new_path` exists.
if !isdir(new_path)
Base.uv_error("rename of $(repr(temp_dir)) to $(repr(new_path))", err)
end
end
chmod(new_path, filemode(dirname(new_path)))
set_readonly(new_path)
end
nothing
end
Expand Down Expand Up @@ -373,7 +377,12 @@ function download_artifact(
return err
finally
# Always attempt to cleanup
rm(temp_dir; recursive=true, force=true)
try
rm(temp_dir; recursive=true, force=true)
catch e
e isa InterruptException && rethrow()
@warn("Failed to clean up temporary directory $(repr(temp_dir))", exception=e)
end
end
return true
end
Expand Down