diff --git a/src/PlatformEngines.jl b/src/PlatformEngines.jl index 813ae7e..c554e38 100644 --- a/src/PlatformEngines.jl +++ b/src/PlatformEngines.jl @@ -90,11 +90,11 @@ function probe_cmd(cmd::Cmd; verbose::Bool = false) @info("Probing $(cmd.exec[1]) as a possibility...") end try - success(cmd) - if verbose + res = success(cmd) + if res && verbose @info(" Probe successful for $(cmd.exec[1])") end - return true + return res catch return false end @@ -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 @@ -369,7 +369,7 @@ function probe_platform_engines!(;verbose::Bool = false) end for path in sh_engines - if probe_cmd(`$path --help`; verbose=verbose) + if probe_cmd(`$path -c ""`; verbose=verbose) gen_sh_cmd = (cmd) -> `$path -c $cmd` if verbose @info("Found sh engine $(path.exec[1])") @@ -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