Skip to content
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

Fix: Use -NoProfile Flag on getCertFromStoreInfo #5842

Merged
merged 2 commits into from
May 10, 2021

Conversation

dapperdandev
Copy link
Contributor

@mmaietta
Copy link
Collaborator

mmaietta commented May 3, 2021

Thanks for your contribution!

Just looking to understand. Can you explain a bit further what's occurring with the addition of -NoProfile? Is it specific now due to using Write-Host?

@dapperdandev
Copy link
Contributor Author

dapperdandev commented May 4, 2021

@mmaietta No problem!

Sorry if I explain stuff you already know.

The -NoProfile flag prevents PowerShell from loading user profile. Profiles usually include things like aliases, quick functions, and some modules. If you have a Windows machine, you can peek at yours by entering code $profile into your powershell terminal (assuming you have vs code installed).

A common use case for a dev to modify their profile is to load oh-my-posh (a fork of oh-my-zsh that works in powershell). I'm sure a lot of profiles start out looking something like mine

function Invoke-LoadModules() {
    Write-Host "Loading Modules..."
    Import-Module posh-git
    Import-Module oh-my-posh
    Set-Theme agnoster
    Write-Host "Loading Modules Complete!"
}

Invoke-LoadModules

So to answer your question, introducing -NoProfle could potentially improve performance since it will bypass loading this file. It should also prevent code signing from breaking if devs have imported any other modules that have output.

Note that it also seems to be the norm in this codebase everywhere else powershell.exe is used:

@mmaietta mmaietta merged commit dd87fcd into electron-userland:master May 10, 2021
@mmaietta mmaietta linked an issue May 10, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getCertificateFromStoreInfo Should use -NoProfile
2 participants