Skip to content

Commit 58946ce

Browse files
committed
Give higher prio to powershell on windows
Signed-off-by: Eric Meadows-Jönsson <[email protected]>
1 parent de1d5ff commit 58946ce

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/mix/lib/mix/utils.ex

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -500,15 +500,17 @@ defmodule Mix.Utils do
500500
File.rm(out_path)
501501

502502
status = cond do
503-
System.find_executable("wget") ->
504-
Mix.shell.cmd(~s(wget -nv -O "#{out_path}" "#{path}"))
505-
System.find_executable("curl") ->
506-
Mix.shell.cmd(~s(curl -s -S -L -o "#{out_path}" "#{path}"))
507503
windows? && System.find_executable("powershell") ->
508504
command = ~s[$ErrorActionPreference = 'Stop'; ] <>
509505
~s[$client = new-object System.Net.WebClient; ] <>
510506
~s[$client.DownloadFile(\\"#{path}\\", \\"#{out_path}\\")]
511507
Mix.shell.cmd(~s[powershell -Command "& {#{command}}"])
508+
System.find_executable("wget") ->
509+
Mix.shell.cmd(~s(wget -nv -O "#{out_path}" "#{path}"))
510+
System.find_executable("curl") ->
511+
Mix.shell.cmd(~s(curl -s -S -L -o "#{out_path}" "#{path}"))
512+
windows? ->
513+
Mix.shell.error "powershell, wget or curl not installed"
512514
true ->
513515
Mix.shell.error "wget or curl not installed"
514516
1

0 commit comments

Comments
 (0)