-
Notifications
You must be signed in to change notification settings - Fork 905
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
Join-Path error when installing Chocolatey as SYSTEM #1042
Comments
Typically the install exits with non-zero on a failure. |
TIL |
Out of curiosity, what happened to |
What do you mean? |
Good to know about the non-zero exit code. That can help us determine if the Chocolatey install failed or not. Unfortunately, that doesn't help our error reporting. We have a daily scheduled task that runs as SYSTEM on developer computers to keep them up-to-date. With our latest update, we are installing Chocolatey. We transcript the update/install process and use the number of errors as our flag to determine if something has gone wrong and notify our team when it has. I'll put together a pull request to fix this issue. |
@splatteredbits Do non-terminating errors get logged into Although fixing these things would be helpful to not error. |
Why does |
Throwing my $.02 in here... This is not a run-as-system problem. For whatever reason,
At least it should be an easy fix. |
@teknowledgist yes, and it's already |
PowerShell sees the return value from [Environment]::GetFolderPath as multiple parameters.
* pr1045: (GH-1042) Ensure-Permissions fails when run as SYSTEM
* stable: (GH-1042) Ensure-Permissions fails when run as SYSTEM (build) ensure build is on .NET 4.0 (maint) remove test console logging (maint) rename searchTerm variable (maint) update nuget.core (GH-1059) Fix: Unable to change command execution timeout (GH-1059) Clean up commandExecutionTimeout setting (maint) clean up CacheLocation (GH-1202) Allow 0 for infinite timeout (GH-1059) Deprecate old config elements
Closed with 3571604 |
What You Are Seeing?
After installing Chocolatey as SYSTEM, $Global:Error has this error:
Our unattended installer reports this as a failed install because of the error (it looks in $Global:Error).
When I look at the code, I see that this error is handled by a try/catch block. Unfortunately in PowerShell, caught exceptions are still populated in $Global:Error.
What is Expected?
I expect that handled errors won't appear in $Global:Error. Otherwise, how do I know if the installation failed or not?
How Did You Get This To Happen? (Steps to Reproduce)
psexec -d -i -s powershell.exe
join-path [Environment]::GetFolderPath("CommonApplicationData") 'chocolatey'
If you assign the value of
[Environment]::GetFolderPath("CommonApplicationData")
to a variable, and join with that, you avoid the error, e.g.Or, wrap
[Environment]::GetFolderPath("CommonApplicationData")
with parenthesis:The text was updated successfully, but these errors were encountered: