-
Notifications
You must be signed in to change notification settings - Fork 206
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
Support skipping profile.ps1
loading in PowerShell Hooks by passing -NoProfile
#4595
base: main
Are you sure you want to change the base?
Conversation
profile.ps1
loading in PowerShell Hooks by passing -NoProfile
@Yionse please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
@rajeshkamal5050 Who should we reach out to for reviewing this PR? |
cmdConfig := " -NoProfile" | ||
normalCmd := "pwsh" | ||
|
||
if !options.IsRunProfile { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sort of wondering if instead of adding IsRunProfile
and setting it in hooks.go
, I wonder if we should be doing it here, so all invocations of pwsh
get it out of the box? I'm sort of wondering if we ever want to not do this for pwsh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ellismg In the current version of azd, pwsh does not support the -NoProfile
parameter because in the exec.NewRunArgs("pwsh", path)
method in the powershell.go file, the default is not have the -NoProfile
parameter, and the hard-coded value is pwsh
, as follow:
So if we want to support the -NoProfile
parameter, we can only add IsRunProfile
here.
Fix issue #4592. This pr determines whether to load
profile.ps1
by checking whether the first sentence of the PowerShell hook command ispwsh -NoProfile
.If the
profile.ps1
file exists in the current environment, but the user does not want to load the file when executing PowerShell hook scripts, the user can configurehooks
like this:If it is a script file, add
pwsh -NoProfile
before command.If it is a command, add
pwsh -NoProfile -Command
before command.@rajeshkamal5050 for notification.