diff options
| author | Alexander Karatarakis <alkarata@microsoft.com> | 2017-10-27 14:45:08 -0700 |
|---|---|---|
| committer | Alexander Karatarakis <alkarata@microsoft.com> | 2017-10-27 15:16:46 -0700 |
| commit | 83c29df043ce91d37a0c463ed854e78caba53984 (patch) | |
| tree | 9564b92da612570d7659bb24e32f4ca31f6d69fd /scripts | |
| parent | 80953867e88f88ca65e0e6d4ddc69009ee11a038 (diff) | |
| download | vcpkg-83c29df043ce91d37a0c463ed854e78caba53984.tar.gz vcpkg-83c29df043ce91d37a0c463ed854e78caba53984.zip | |
[fetchDependency] Fix compat with Powershell 2
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/fetchDependency.ps1 | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/scripts/fetchDependency.ps1 b/scripts/fetchDependency.ps1 index df03878eb..90de17717 100644 --- a/scripts/fetchDependency.ps1 +++ b/scripts/fetchDependency.ps1 @@ -8,6 +8,11 @@ function Test-Command($commandName) return [bool](Get-Command -Name $commandName -ErrorAction SilentlyContinue) } +function Test-CommandParameter($commandName, $parameterName) +{ + return (Get-Command $commandName).Parameters.Keys -contains $parameterName +} + function Test-Module($moduleName) { return [bool](Get-Module -ListAvailable -Name $moduleName) @@ -51,7 +56,16 @@ function SelectProgram([Parameter(Mandatory=$true)][string]$Dependency) $ProxyAuth = !$WC.Proxy.IsBypassed($url) if ($ProxyAuth) { - $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + if (Test-CommandParameter -commandName 'Get-Credential' -parameterName 'Message') + { + $ProxyCred = Get-Credential -Message "Enter credentials for Proxy Authentication" + } + else + { + "Enter credentials for Proxy Authentication" + $ProxyCred = Get-Credential + } + $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyAuthentication","Basic") $PSDefaultParameterValues.Add("Start-BitsTransfer:ProxyCredential",$ProxyCred) $WC.Proxy.Credentials=$ProxyCred |
