majkinetor / au

Chocolatey Automatic Package Updater Module
GNU General Public License v2.0
227 stars 71 forks source link

[Feature Request] Add PowerShell Core Support #158

Open Elderry opened 6 years ago

Elderry commented 6 years ago

Just a recommendation, currently run script.ps1 will encounter:

Exception setting "SecurityProtocol": "The requested security protocol is not supported."
At C:\Program Files\PowerShell\Modules\au\2018.5.18\Public\Update-Package.ps1:384 char:5
+     [System.Net.ServicePointManager]::SecurityProtocol = 'Ssl3,Tls,Tl ...
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting

and

Get-WebFile : Exception calling "IsBypassed" with "1" argument(s): "Operation is not supported on this platform."
At C:\Users\Ruiyang\AppData\Local\Temp\chocolatey\au\chocolatey\helpers\functions\Get-ChocolateyWebFile.ps1:345 char:7
+       Get-WebFile -Url $url -FileName $fileFullPath -Options $options
+       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Get-WebFile], MethodInvocationException
+ FullyQualifiedErrorId : PlatformNotSupportedException,Get-WebFile
majkinetor commented 4 years ago

Get-WebFile is used during automatic chekcsuming which is a feature that doesn't need to be used at all (I almost never do and consider it deprecated, but I will not remove it as others use it a lot).

Regarding [System.Net.ServicePointManager]::SecurityProtocol, this is one liner problem which is trivially easy to fix by somebody that uses AU on pwsh. I will skip v6 and jump to 7 so that will not be me. The point is this is not a deal breaker.

pjoe commented 3 years ago

Think I ran into this trying to use au with GitHub Actions, see: https://github.com/pjoe/loadem/runs/1254716907?check_suite_focus=true#step:9:92

pjoe commented 3 years ago

heh, turns out it was defaulting to pwsh (7), after explicitly using powershell things are working as expected :)

majkinetor commented 3 years ago

I use it with pwsh7 locally tho...