Skip to content

Commit

Permalink
Check powershell version number
Browse files Browse the repository at this point in the history
Alternative fix for JuliaPackaging#127
  • Loading branch information
simonbyrne authored Oct 16, 2018
1 parent cb403e6 commit 2ea0551
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/PlatformEngines.jl
Original file line number Diff line number Diff line change
Expand Up @@ -260,17 +260,17 @@ function probe_platform_engines!(;verbose::Bool = false)
\$webclient.DownloadFile("$url", "$path")
"""
replace(webclient_code, "\n" => " ")
return `$psh_path -NoProfile -Command "$webclient_code"`
return `$psh_path -Version 3 -NoProfile -Command "$webclient_code"`
end
end

# We want to search both the `PATH`, and the direct path for powershell
psh_path = "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell"
prepend!(download_engines, [
(`$psh_path -Command ""`, psh_download(psh_path))
(`$psh_path -Version 3 -NoProfile -Command ""`, psh_download(psh_path))
])
prepend!(download_engines, [
(`powershell -Command ""`, psh_download(`powershell`))
(`powershell -Version 3 -NoProfile -Command ""`, psh_download(`powershell`))
])

# We greatly prefer `7z` as a compression engine on Windows
Expand Down Expand Up @@ -385,7 +385,11 @@ function probe_platform_engines!(;verbose::Bool = false)
if !download_found
errmsg *= "No download engines found. We looked for: "
errmsg *= join([d[1].exec[1] for d in download_engines], ", ")
errmsg *= ". Install one and ensure it is available on the path.\n"
errmsg *= ". Install one and ensure it is available on the path.\n"
if Sys.iswindows()
errmsg *= "Ensure Windows Management Framework 3.0 or later "
errmsg *= "is installed and that Windows PowerShell can be started.\n"
end
end

if !compression_found
Expand Down

0 comments on commit 2ea0551

Please sign in to comment.