RamblingCookieMonster / PSDepend

PowerShell Dependency Handler
MIT License
285 stars 76 forks source link

Chocolatey Dependency hangs if there should be a prompt. #119

Open Levistator opened 4 years ago

Levistator commented 4 years ago

I found this issue while using the 'Chocolatey::jfrog-cli' dependency. Invoke-PSDepend would hang indefinitely without ever displaying the prompt for chocolatey.

I figured out what the issue was after attempting to run the choco command manually and getting the prompts.

The fix that I am proposing (wanted others opinions on it) is: /PSDependScripts/Chocolatey.ps1/Invoke-ChocoInstallPackage line 130: $chocoParams = @('upgrade', "$Name", '--limit-output', '--exact', '--no-progress', '--allow-downgrade', '--yes') Adding the --yes parameter will cause Chocolatey to always accept for any prompts.

Otherwise, a solution would be to figure out why those prompts are not displaying already. I think this would be a better solution but the work involved is much greater.

P.S. If I inputted a y as a response to the prompts (even though I couldn't see the prompts) it was passed through to Chocolatey and the install completed successfully.

ENVIRONMENT: Windows 10: [Version 10.0.19041.388] VSCode: 1.47.3 Powershell Plugin: 2020.6.0 Powershell Version: 5.1.19041.1

gaelcolas commented 4 years ago

You can set choco settings to always add --yes, but I'd agree your suggestion is sensible.

gaelcolas commented 3 years ago

You can also have choco configured with --yes as default by doing this: chocolatey feature enable -n allowGlobalConfirmation