fix(pwsh): set env vars in restricted mode

resolves #1100
This commit is contained in:
Jan De Dobbeleer 2021-10-28 10:42:06 +02:00 committed by Jan De Dobbeleer
parent d789b3c252
commit dbee7edde7

View file

@ -5,21 +5,14 @@ $env:POWERLINE_COMMAND = "oh-my-posh"
$env:CONDA_PROMPT_MODIFIER = $false
# specific module support (disabled by default)
function Set-DefaultEnvValue {
[CmdletBinding()]
param (
[Parameter(Mandatory = $true)]
[string]
$Name
)
$value = [System.Environment]::GetEnvironmentVariable($Name)
if ($value -eq $null) {
[System.Environment]::SetEnvironmentVariable($Name, $false)
}
$value = $env:AZ_ENABLED
if ($null -eq $value) {
$env:AZ_ENABLED = $false
}
$value = $env:POSH_GIT_ENABLED
if ($null -eq $value) {
$env:POSH_GIT_ENABLED = $false
}
Set-DefaultEnvValue("AZ_ENABLED")
Set-DefaultEnvValue("POSH_GIT_ENABLED")
$global:PoshSettings = New-Object -TypeName PSObject -Property @{
Theme = "";