-
Notifications
You must be signed in to change notification settings - Fork 904
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
Choco New creates a bad ChocolateyUninstall.ps1 script which does not work. #460
Comments
That was a late acceptance. I guess we didn't check over that good enough. You can see the script at https://github.com/chocolatey/choco/blob/master/src/chocolatey/infrastructure.app/templates/ChocolateyUninstallTemplate.cs |
Thanks. I've submitted a pull request for the amendment. |
I've found a case which causes the current template to fail (and is unrelated to the [array]) Pesky UninstallString:
Error log |
For reference, if you are being bitten by this by running Specifically, prefix
|
Yep, we are working on that one still. |
* stable: (GH-460) Amended Template (GH-623) Extract Nuspec on Install (GH-674)(GH-672) Color Overrides / Fix Write-Host (GH-181) log selection to log file only (GH-181)(GH-184) Short prompt/Prompt character (GH-675) Template include LICENSE/VERIFICATION (GH-258) Rename zip to detector.zip (GH-572) Fix: The handle is invalid - Output Redirection (maint) comments (GH-667) Provide How To Add Profile Manually (GH-667) PowerShell Custom Host - Set $Profile (GH-666) pass Write-ChocolateyError message param (GH-673) Ensure Get-BinRoot Warning is Shown (GH-666) setup logs colored write-host w/fallback
When using Choco New to create a new ChocolateyInstall.ps1 and ChocolaetyUninstall.ps1 script the uninstall one is bad. See below:
$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) ` -ErrorAction SilentlyContinue` | ? { $_.DisplayName -like "$softwareName" }
if ($key.Count -eq 1) {
...
That if statement will never execute as when $key only has one value it's not an Array so doesn't have a Count method. The fix is to force $key to be an array:
[array]$key = Get-ItemProperty -Path @($machine_key6432,$machine_key, $local_key) ` -ErrorAction SilentlyContinue` | ? { $_.DisplayName -like "$softwareName" }
if ($key.Count -eq 1) {
I would just submit a pull request but I have no idea where it gets the script or if it generates it on the fly.
The text was updated successfully, but these errors were encountered: