Refactor winget check for rare issue

This commit is contained in:
Manuel Thalmann 2024-08-16 15:04:37 +02:00
parent 050221da47
commit 4e97645eea

View file

@ -78,10 +78,14 @@ function Test-Command {
Checks whether `winget` is working properly.
#>
function Test-Winget {
(Test-Command winget) -and -not (
[System.Linq.Enumerable]::Any(
[string[]](winget source update winget),
(Test-Command winget) -and (
& {
$output = winget source update winget;
$? -and -not ([System.Linq.Enumerable]::Any(
[string[]]($output),
[System.Func[string,bool]]{ param($line) $line -eq "Cancelled"; }));
});
}
<#