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
Installation/Setup - Use of Write-Host in Install-ChocolateyPath.ps1 prevents non-interactive installation of Chocolatey itself #1560
Comments
Write-Output is a bit dangerous as it means that is returned at the end of the method, and we just want notification. This should only affect installation of Chocolatey as after that you would be using Chocolatey's built in PowerShell host. What version of PowerShell is being used here? |
In this case the write-output might be fine but I'd like to use Write-Information if available (PowerShell 5+) |
More information on the VSTS Task here: https://docs.microsoft.com/en-us/vsts/build-release/tasks/deploy/powershell-on-target-machines?view=vsts (My VM is a recent windows server version, so I'd be okay with a PowerShell 5+ requirement) FYI: No output except Write-Verbose is visible from scripts in VSTS, so it is not important (for me) whether you use EDIT: I can confirm that installing other software (using the -y parameter) works without modifications |
@meastp yep, just during that install when it is using system PowerShell is where we'd hit these things. I know we've made adjustments for DSC, I thought we were covered on all of them but perhaps this was introduced more recently. |
Thank you for the quick fix! Please add a reference to the commit where this is fixed / pull request, because this would make it easier to check when the fix is included in a release. :) |
Also note the milestone above, that tells you what release it will go into. |
When PowerShell functions are used as part of installing Chocolatey itself, it can cause issues if they call Write-Host. Note all of the functions that are called from Setup, then wrap any existing with try/catch.
You might also want to join the release announcements list at https://groups.google.com/forum/#!forum/chocolatey-announce to learn when new Chocolatey-related things are released. |
Ah, ok, thanks for the explanation :) (I noticed the milestone and the fact that I did not find a commit with the fix confused me, that's all :) ) |
What You Are Seeing?
Trying to install Chocolatey in a Azure VM using "Power Shell on Target Machines" from VSTS fails because Write-Host (which is not supported in non-interactive mode) is used in Install-ChocolateyPath.ps1:84
I fell back to downloading and modifying the .nuget-package manually, and modifying the mentioned line from:
to:
error output exerpt from VSTS before the above fix was done:
What is Expected?
Installation should work with the default installation method, without having to download the nuget-package manually.
The text was updated successfully, but these errors were encountered: