From 4f3b057d52db6f9d86e50da3f6887d76d7206236 Mon Sep 17 00:00:00 2001 From: "staticfloat@gmail.com" Date: Tue, 3 Apr 2018 13:33:33 -0700 Subject: [PATCH 1/2] Work around https://github.com/JuliaLang/julia/issues/26685 --- src/Prefix.jl | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Prefix.jl b/src/Prefix.jl index 91a0824..98bacfa 100644 --- a/src/Prefix.jl +++ b/src/Prefix.jl @@ -8,6 +8,19 @@ export Prefix, bindir, libdir, includedir, logdir, activate, deactivate, extract_platform_key, install, uninstall, manifest_from_url, manifest_for_file, list_tarball_files, verify, temp_prefix, package + +# Temporary hack around https://github.com/JuliaLang/julia/issues/26685 +function safe_isfile(path) + try + return isfile(path) + catch e + if typeof(e) <: Base.UVError && e.code == Base.UV_EINVAL + return false + end + rethrow(e) + end +end + """ temp_prefix(func::Function) @@ -270,7 +283,7 @@ function install(tarball_url::AbstractString, try mkpath(dirname(tarball_path)) end # Check to see if we're "installing" from a file - if isfile(tarball_url) + if safe_isfile(tarball_url) # If we are, just verify it's already downloaded properly tarball_path = tarball_url From 83a73f52120596f17cdb5dc9f345ffc393ea3778 Mon Sep 17 00:00:00 2001 From: "staticfloat@gmail.com" Date: Tue, 3 Apr 2018 13:59:16 -0700 Subject: [PATCH 2/2] Add tests for `safe_isfile()` --- test/runtests.jl | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/runtests.jl b/test/runtests.jl index 9651c7d..ea983fd 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -611,6 +611,12 @@ const libfoo_downloads = Dict( # Test manually downloading and using libfoo @testset "Downloading" begin temp_prefix() do prefix + foo_path = joinpath(prefix,"foo") + touch(foo_path) + # Quick one-off tests for `safe_isfile()`: + @test BinaryProvider.safe_isfile(foo_path) + @test !BinaryProvider.safe_isfile("http://google.com") + if !haskey(libfoo_downloads, platform) Compat.@warn("Platform $platform does not have a libfoo download, skipping download tests") else