File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,13 @@ type pwsh struct{}
3030var Pwsh Shell = pwsh {}
3131
3232const hook = `
33+
34+ # All environment variables must be set in global scope
35+ # DO NOT PUT IN MODULE
3336{{.EnvContent}}
3437
38+ $env:__VFOX_PID = $pid;
39+
3540# remove any existing dynamic module of vfox
3641if ($null -ne (Get-Module -Name "version-fox")) {
3742 Remove-Module -Name "version-fox" -Force
@@ -45,7 +50,6 @@ New-Module -Name "version-fox" -ScriptBlock {
4550 #>
4651 & '{{.SelfPath}}' env --cleanup 2>$null | Out-Null;
4752
48- $env:__VFOX_PID = $pid;
4953 $originalPrompt = $function:prompt;
5054 $OutputEncoding = [console]::InputEncoding = [console]::OutputEncoding = [Text.UTF8Encoding]::UTF8;
5155
@@ -70,7 +74,6 @@ New-Module -Name "version-fox" -ScriptBlock {
7074 # perform cleanup on removal so a new initialization in current session works
7175 $ExecutionContext.SessionState.Module.OnRemove += {
7276 $function:prompt = $originalPrompt
73- Remove-Item -Path Env:__VFOX_PID
7477 Unregister-Event -SubscriptionId $subscription.Id
7578 }
7679} | Import-Module -Global
You can’t perform that action at this time.
0 commit comments