From 2ea055184e1e8e5a992bfeb9f6a6ded30b560eb9 Mon Sep 17 00:00:00 2001 From: Simon Byrne Date: Tue, 16 Oct 2018 15:06:06 -0700 Subject: [PATCH] Check powershell version number Alternative fix for #127 --- src/PlatformEngines.jl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/PlatformEngines.jl b/src/PlatformEngines.jl index 813ae7e..bc150fe 100644 --- a/src/PlatformEngines.jl +++ b/src/PlatformEngines.jl @@ -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 @@ -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