Skip to content

Commit 2ea0551

Browse files
authored
Check powershell version number
Alternative fix for JuliaPackaging#127
1 parent cb403e6 commit 2ea0551

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/PlatformEngines.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -260,17 +260,17 @@ function probe_platform_engines!(;verbose::Bool = false)
260260
\$webclient.DownloadFile("$url", "$path")
261261
"""
262262
replace(webclient_code, "\n" => " ")
263-
return `$psh_path -NoProfile -Command "$webclient_code"`
263+
return `$psh_path -Version 3 -NoProfile -Command "$webclient_code"`
264264
end
265265
end
266266

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

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

391395
if !compression_found

0 commit comments

Comments
 (0)