Skip to content
This repository has been archived by the owner on Aug 16, 2023. It is now read-only.

Commit

Permalink
Hh/no errors (#166)
Browse files Browse the repository at this point in the history
* Escape path and use different quotes for windows OS

* Suppress symlink warning during `probe_symlink_creation(...)`; avoid tar error message for windows 10 during `probe_platform_engines!()`
  • Loading branch information
hhaensel authored and staticfloat committed Jun 18, 2019
1 parent 6b34650 commit 7168f68
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ version = "0.5.4"

[deps]
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"

[compat]
Expand Down
2 changes: 1 addition & 1 deletion src/BinaryProvider.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module BinaryProvider

using Libdl
using Libdl, Logging

# Utilities for controlling verbosity
include("LoggingUtils.jl")
Expand Down
10 changes: 8 additions & 2 deletions src/PlatformEngines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,9 @@ function probe_symlink_creation(dest::AbstractString)
link_path *= "1"
end

loglevel = Logging.min_enabled_level(current_logger())
try
disable_logging(Logging.Warn)
symlink("foo", link_path)
return true
catch e
Expand All @@ -128,6 +130,7 @@ function probe_symlink_creation(dest::AbstractString)
end
rethrow(e)
finally
disable_logging(loglevel-1)
rm(link_path; force=true)
end
end
Expand Down Expand Up @@ -267,8 +270,11 @@ function probe_platform_engines!(;verbose::Bool = false)
# Windows 10 now has a `tar` but it needs the `-f -` flag to use stdin/stdout
# The Windows 10 tar does not work on substituted drives (`subst U: C:\Users`)
# If a drive letter is part of the filename, then tar spits out a warning on stderr:
# "tar: Removing leading drive letter from member names" - but it works properly
tarListing = read(pipeline(`$tar_cmd -cf - $tmpfile`, `$tar_cmd -tvf -`), String)
# "tar: Removing leading drive letter from member names"
# Therefore we cd to tmpdir() first
cd(tempdir()) do
tarListing = read(pipeline(`$tar_cmd -cf - $(basename(tmpfile))`, `$tar_cmd -tvf -`), String)
end
# obtain the text of the line before the filename
m = match(Regex("((?:\\S+\\s+)+?)$tmpfile"), tarListing)[1]
# count the number of words before the filename
Expand Down
5 changes: 3 additions & 2 deletions src/Products.jl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ function locate(lp::LibraryProduct; verbose::Bool = false,
if platforms_match(platform, platform_key_abi())
if isolate
# Isolated dlopen is a lot slower, but safer
if success(`$(Base.julia_cmd()) -e "import Libdl; Libdl.dlopen(\"$dl_path\")"`)
dl_esc_path = replace(dl_path, "\\"=>"\\\\")
if success(`$(Base.julia_cmd()) -e "import Libdl; Libdl.dlopen(\"$(dl_esc_path)\")"`)
return dl_path
end
else
Expand Down Expand Up @@ -341,7 +342,7 @@ function locate(fp::FileProduct; platform::Platform = platform_key_abi(),
mappings["\$$(var)"] = string(val)
mappings["\${$(var)}"] = string(val)
end

expanded = fp.path
for (old, new) in mappings
expanded = replace(expanded, old => new)
Expand Down

0 comments on commit 7168f68

Please sign in to comment.