Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

* Disables Verbose progress during install and upgrade (#175). #178

Open
wants to merge 2 commits into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 25 additions & 2 deletions DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,15 @@ function InstallPackage

$cmd = "choco install $pName $chocoParams"
Write-Verbose -Message "Install command: '$cmd'"
$packageInstallOuput = Invoke-Expression -Command $cmd
Write-Verbose -Message "Package output $packageInstallOuput"

$currentProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'

$packageInstallOutput = Invoke-Expression -Command $cmd

$ProgressPreference = $currentProgressPreference

Write-Verbose -Message "Package output $packageInstallOutput"

# Clear Package Cache
Get-ChocoInstalledPackage -Purge
Expand Down Expand Up @@ -487,9 +494,14 @@ Function Upgrade-Package {
throw "$pName is not installed, you cannot upgrade"
}

$currentProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'

$packageUpgradeOuput = Invoke-Expression -Command $cmd
$packageUpgradeOuput | ForEach-Object { Write-Verbose -Message $_ }

$ProgressPreference = $currentProgressPreference

# Clear Package Cache
Get-ChocoInstalledPackage -Purge
}
Expand All @@ -501,6 +513,11 @@ function Get-ChocoInstalledPackage {
[switch]$NoCache
)

if ([string]::IsNullOrEmpty($env:ChocolateyInstall))
{
$env:ChocolateyInstall = [environment]::GetEnvironmentVariable('ChocolateyInstall', 'Machine')
}

$ChocoInstallLP = Join-Path -Path $env:ChocolateyInstall -ChildPath 'cache'
if ( -not (Test-Path $ChocoInstallLP)){
New-Item -Name 'cache' -Path $env:ChocolateyInstall -ItemType Directory | Out-Null
Expand Down Expand Up @@ -532,6 +549,12 @@ function Get-ChocoVersion {
[switch]$Purge,
[switch]$NoCache
)

if ([string]::IsNullOrEmpty($env:ChocolateyInstall))
{
$env:ChocolateyInstall = [environment]::GetEnvironmentVariable('ChocolateyInstall', 'Machine')
}

$chocoInstallCache = Join-Path -Path $env:ChocolateyInstall -ChildPath 'cache'
if ( -not (Test-Path $chocoInstallCache)){
New-Item -Name 'cache' -Path $env:ChocolateyInstall -ItemType Directory | Out-Null
Expand Down