cChoco icon indicating copy to clipboard operation
cChoco copied to clipboard

Turn off installation progress for cChocoPackageInstall to stop it filling the verbose log output

Open rcarpenter79 opened this issue 2 years ago • 4 comments
trafficstars

Checklist

  • [X] I have verified this is the correct repository for opening this issue.
  • [X] I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

Yes. Verbose output is a mess when logging installation progress.

cChcocoPackageInstall_Verbose_Output

Describe The Solution. Why is it needed?

Set $ProgressPreferences to 'SilentlyContinue' in InstallPackage before running 'choco install'

Example: I also corrected a typo in $packageInstallOutput.

    $cmd = "choco install $pName $chocoParams"
    Write-Verbose -Message "Install command: '$cmd'"

    $currentProgressPreference = $ProgressPreference
    $ProgressPreference = 'SilentlyContinue'

    $packageInstallOutput = Invoke-Expression -Command $cmd

    $ProgressPreference = $currentProgressPreference

    Write-Verbose -Message "Package output $packageInstallOutput"

Additional Context

No response

Related Issues

No response

rcarpenter79 avatar Apr 13 '23 09:04 rcarpenter79

@rcarpenter79 have you by chance tested this change? I didn't know Chocolatey picked up the ProgressPreference from the invoking PowerShell session. If you've confirmed it works, would you be interested in creating a Pull Request for this change?

If it doesn't work, then you can likely fix it with passing --no-progress to Chocolatey.

corbob avatar Jul 06 '23 20:07 corbob

@corbob I have updated my fork with the upstream changes and merged my changes. Do you want me to create another merge request now?

rcarpenter79 avatar Oct 11 '23 09:10 rcarpenter79

@rcarpenter79 no need to open a new pr, just updating the existing one is sufficient.

corbob avatar Oct 12 '23 01:10 corbob

@rcarpenter79 apologies for the delays in getting to look at this. I was looking at the PR today to hopefully merge it, but I'm not able to reproduce the initial issue. When I run in a test environment, the output explicitly says it's calling choco install notepadplusplus --no-progress and so doesn't have any download progress. Could you verify which version of cChoco you're using? It looks like that was added quite a while ago, so I'm not sure how you could be seeing the download progress: https://github.com/chocolatey/cChoco/blob/f583fee2724283820a4405588c1bf37be4d55518/DSCResources/cChocoPackageInstall/cChocoPackageInstall.psm1#L288-L290

corbob avatar Oct 19 '23 23:10 corbob