diff --git a/stdlib/Pkg/test/pkg.jl b/stdlib/Pkg/test/pkg.jl index 357580dad23af..ca8259e058ff2 100644 --- a/stdlib/Pkg/test/pkg.jl +++ b/stdlib/Pkg/test/pkg.jl @@ -40,7 +40,10 @@ function temp_pkg_dir(fn::Function, tmp_dir=joinpath(tempdir(), randstring()), end fn() finally - remove_tmp_dir && rm(tmp_dir, recursive=true) + if remove_tmp_dir + Sys.iswindows() && gc() # to make sure handles are closed on Windows + rm(tmp_dir, recursive=true) + end end end end