-
Notifications
You must be signed in to change notification settings - Fork 163
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
Prevent error when installing more than one Chocolatey font package #455
Comments
The install appears to be failing because it is trying to run https://chocolatey.org/packages/chocolatey-font-helpers.extension mentions that there is a multiple font option, which https://chocolatey.org/packages/cascadia-code-nerd-font is not using. However I just tested installing cascadia-code-nerd-font myself and can confirm it installs without error. This is strange! |
At a guess I'd say this is happening as Boxstarter runs those commands in that script in the same context. Boxstarter doesn't directly call choco so I'm assuming doesn't use it's PowerShell host that would isolate package installation. So when you're running the second That's a guess. I'm not in a position to check just now. But I'd also think that this is a package issue. A workaround would be to put a reboot between them? @mwallner thoughts? |
@flcdrg and @pauby both already got to the correct conclusion: Since Boxstarter doesn't spawn a separate PowerShell host for each
So both package installations add the Type tbh, despite heavy Boxstarter usage this behavior never occurred in my environments, yet it's definitely something we haven't thought of. as @pauby suggested, a forced reboot between the package installations may be used to bypass the error. (imo it's more a dirty hack than a workaround 😄) could by 'fixed' by something like this:
I think the "installation scope separation" is something we should put on our agenda for the next Boxstarter release. edit.: in addition to that, it may be a good idea to fix |
A side comment to this: I happened to notice that the source code for the font extension package doesn't actually match what's in the latest version of the package. Might add a comment on the package for the maintainers |
Hi @mwallner et al - thanks for looking into this - besides the mentioned "installation scope separation" topic for Boxstarter is there a recommendation for choco package authors/maintainers to be more defensive with Add-Type
I understand it's fine when running outside of Boxstarter but I think a lot of the choco usage is in the context of Boxstarter (at least for us) FWIW automated font installation on Windows is harder than it should be - we have a pretty rich Boxstarter script to initialize our dev machines and the pain point is installing fonts?!? Feel free to disposition this issue as you see fit |
I really don't see a way around this at the moment. Looking at the help for Add-Type, under
So in the context of Boxstarter I'm not sure what we can do given the current design. We need to start a new session and the only way that can be done is via a reboot. Anything else would likely require major re-engineering of Boxstarter. If anybody disagrees please feel free to add here. Long term this may be resolved by #394, if that goes ahead. |
A possible mitigation might be to submit a patch to https://chocolatey.org/packages/chocolatey-font-helpers.extension so that the A followup to my comment on that package notes that @teknowledgist is now maintaining the source under https://github.com/teknowledgist/Chocolatey-packages/tree/master/extensions/chocolatey-font-helpers.extension |
@flcdrg - I forked the chocolatey-font-helpers.extension from @bcurran3 (it was unclear exactly who was maintaining) and submitted a PR wrapping Add-Type with an existence check. I think that should fix the issue. I suppose I can do the same for @teknowledgist implementation BTW - when there are multiple maintainers of a choco package how do you tell which one is "shipping"
|
ok ok ok ... I've cracked my head against this problem, and tbh, fixing the font packages is something we should do - but imo this is not a proper solution to the current problem @KZeronimo is facing. I just came up with a crazy idea that might actually work and probably could be implemented in Boxstarter if we spend a little more thought on it! 😄 @KZeronimo try the following:
right after that, add a custom
after that, do your
at the very end of your boxstarter package, remove the custom added
ta-da 😄 |
@pauby @flcdrg see comment above, I think I might be onto something. |
I just pushed v0.3 of the Chocolatey Font Helpers extension that should resolve the issue of trying to re-add the type and (hopefully) give better error messaging for an unusual font add/remove failure. Let me know if it works (or not) for you. |
@mwallner - edit: tried in Boxstarter context - removing public gist Still getting @teknowledgist will try the updated extension when it is approved (not sure how to test before that) |
thanks for the feedback @KZeronimo! I'm not entirely sure why this doesn't work in Boxstarter context, yet seems to work just fine in a plain poweshell prompt. 😕
|
@KZeronimo the new 0.0.3 package is now approved, so give it a try. I suspect installing the extension explicitly would also have worked. eg. add |
@flcdrg - yep was trying that - I looked in the font packages I'm trying in this example - sourcecodepro and cascadia-code-nerd-font both don't seem to use the font extensions - it looks like they just include the boilerplate The idea floated by @mwallner still might be useful for font packages not leveraging the choco font extension |
@KZeronimo cascadia-code-nerd-font uses the extension, but yes unfortunately sourcecodepro doesn't - older font packages probably didn't know about it when they were created. |
@flcdrg - do you see anything wrong with the test I'm trying to do?
Logsedit: Remove gist of logs - key logs
|
Sorry! 🤦♂️ I think (hope!) it's fixed now with v0.0.3.1. cascadia-code-nerd-font is installing now at least. (Anyone with C# error handling skills is welcome to contribute. 😄 ) |
@teknowledgist it looks like 0.0.3.1 is functioning as expected - I tested The issue of legacy font packages that don't use the extension is a maintenance item @flcdrg @mwallner - let me know if you want me to try anything else in the context of Boxstarter and the idea of the |
🎉 This issue has been resolved in version 3.0.0 🎉 The release is available on:
Your GitReleaseManager bot 📦🚀 |
What You Are Seeing?
Strange error when installing font choco packages via Boxtarter
What Is Expected?
Both choco packages install successfully which is what happens when executing outside of Boxstarter
How Did You Get This To Happen? (Steps to Reproduce)
Create a Boxstarter package with the following
Output Log
edit: removed public gist of logs - key log output
The text was updated successfully, but these errors were encountered: