From 60ab4be0b7bf87acdc699f3126bd3c015943d55b Mon Sep 17 00:00:00 2001 From: sriharshakandala Date: Wed, 13 Nov 2024 13:59:56 -0800 Subject: [PATCH] Replace `Base.cp` with run(...) on non-Windows operating systems. `Base.cp` seems to have a bug when copying large files. Using `run` fixes this behaviour. This fixes the bug mentioned in https://github.com/CliMA/ClimaArtifacts/pull/64 --- ClimaArtifactsHelper.jl/src/ClimaArtifactsHelper.jl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ClimaArtifactsHelper.jl/src/ClimaArtifactsHelper.jl b/ClimaArtifactsHelper.jl/src/ClimaArtifactsHelper.jl index 1ac2d76..1431214 100644 --- a/ClimaArtifactsHelper.jl/src/ClimaArtifactsHelper.jl +++ b/ClimaArtifactsHelper.jl/src/ClimaArtifactsHelper.jl @@ -204,8 +204,12 @@ function create_artifact_guided_one_file( downloaded_file = download(file_url) Base.mv(downloaded_file, file_path) end - - Base.cp(file_path, joinpath(output_dir, basename(file_path))) + # There are issues with large files in Base.cp https://github.com/JuliaLang/julia/issues/56537 + if Sys.iswindows() + Base.cp(file_path, joinpath(output_dir, basename(file_path))) + else + run(`cp $file_path $(joinpath(output_dir, basename(file_path)))`) + end create_artifact_guided(output_dir; artifact_name, append) end