diff --git a/base/pkg/dir.jl b/base/pkg/dir.jl index 9302184523bd8..be91b7bba06bf 100644 --- a/base/pkg/dir.jl +++ b/base/pkg/dir.jl @@ -48,7 +48,7 @@ function init(meta::String=DEFAULT_META, branch::String=META_BRANCH) run(`touch REQUIRE`) end catch e - rm(dir, recursive=true) + ispath(dir) && rm(dir, recursive=true) rethrow(e) end end diff --git a/test/pkg.jl b/test/pkg.jl index a329d8b7d68d3..e9f22dfacf899 100644 --- a/test/pkg.jl +++ b/test/pkg.jl @@ -1,6 +1,6 @@ function temp_pkg_dir(fn::Function) # Used in tests below to setup and teardown a sandboxed package directory - const tmpdir = ENV["JULIA_PKGDIR"] = tempname() + const tmpdir = ENV["JULIA_PKGDIR"] = joinpath(tempdir(),randstring()) @test !isdir(Pkg.dir()) try Pkg.init()