Skip to content

Commit

Permalink
fix(pwsh): set env vars in restricted mode
Browse files Browse the repository at this point in the history
resolves #1100
  • Loading branch information
JanDeDobbeleer committed Oct 28, 2021
1 parent d789b3c commit dbee7ed
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/init/omp.ps1
Expand Up @@ -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 = "";
Expand Down

0 comments on commit dbee7ed

Please sign in to comment.