From 3ab845e731c25f5931af1a2c97643f3660b2210e Mon Sep 17 00:00:00 2001 From: Stefan Karpinski Date: Sun, 22 Apr 2018 21:27:10 +0100 Subject: [PATCH] hack to avoid perm error when rm:ing temp dir on windows --- stdlib/Pkg/test/pkg.jl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stdlib/Pkg/test/pkg.jl b/stdlib/Pkg/test/pkg.jl index 357580dad23af..f8b15d9b386ca 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.gc() # to make sure handles are closed on Windows + rm(tmp_dir, recursive=true) + end end end end