Skip to content

Commit

Permalink
Add ErrorAction
Browse files Browse the repository at this point in the history
  • Loading branch information
asheroto committed Nov 9, 2024
1 parent 8f1b885 commit 139a5a0
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions winget-install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -937,9 +937,9 @@ function Install-NuGetIfRequired {
Write-Debug "Installing NuGet PackageProvider..."

if ($Debug) {
try { Install-PackageProvider -Name "NuGet" -Force -ForceBootstrap } catch { }
try { Install-PackageProvider -Name "NuGet" -Force -ForceBootstrap -ErrorAction SilentlyContinue } catch { }
} else {
try { Install-PackageProvider -Name "NuGet" -Force -ForceBootstrap | Out-Null } catch {}
try { Install-PackageProvider -Name "NuGet" -Force -ForceBootstrap -ErrorAction SilentlyContinue | Out-Null } catch {}
}
} else {
# NuGet should be included by default in PowerShell 7, so if it's not detected, advise reinstallation
Expand Down Expand Up @@ -1069,9 +1069,9 @@ try {

Write-Output "Installing Microsoft.WinGet.Client module..."
if ($Debug) {
try { Install-Module -Name Microsoft.WinGet.Client -Force -AllowClobber -Repository PSGallery } catch { }
try { Install-Module -Name Microsoft.WinGet.Client -Force -AllowClobber -Repository PSGallery -ErrorAction SilentlyContinue } catch { }
} else {
try { Install-Module -Name Microsoft.WinGet.Client -Force -AllowClobber -Repository PSGallery *>&1 | Out-Null } catch { }
try { Install-Module -Name Microsoft.WinGet.Client -Force -AllowClobber -Repository PSGallery -ErrorAction SilentlyContinue *>&1 | Out-Null } catch { }
}

Write-Output "Installing winget (this takes a minute or two)..."
Expand Down

0 comments on commit 139a5a0

Please sign in to comment.