Skip to content

Commit dbee7ed

Browse files
fix(pwsh): set env vars in restricted mode
resolves #1100
1 parent d789b3c commit dbee7ed

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

src/init/omp.ps1

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,14 @@ $env:POWERLINE_COMMAND = "oh-my-posh"
55
$env:CONDA_PROMPT_MODIFIER = $false
66

77
# specific module support (disabled by default)
8-
function Set-DefaultEnvValue {
9-
[CmdletBinding()]
10-
param (
11-
[Parameter(Mandatory = $true)]
12-
[string]
13-
$Name
14-
)
15-
16-
$value = [System.Environment]::GetEnvironmentVariable($Name)
17-
if ($value -eq $null) {
18-
[System.Environment]::SetEnvironmentVariable($Name, $false)
19-
}
8+
$value = $env:AZ_ENABLED
9+
if ($null -eq $value) {
10+
$env:AZ_ENABLED = $false
11+
}
12+
$value = $env:POSH_GIT_ENABLED
13+
if ($null -eq $value) {
14+
$env:POSH_GIT_ENABLED = $false
2015
}
21-
Set-DefaultEnvValue("AZ_ENABLED")
22-
Set-DefaultEnvValue("POSH_GIT_ENABLED")
2316

2417
$global:PoshSettings = New-Object -TypeName PSObject -Property @{
2518
Theme = "";

0 commit comments

Comments
 (0)