fix(pwsh): allow ConstrainedLanguage mode

relates to #2369
This commit is contained in:
Jan De Dobbeleer 2022-06-25 20:03:24 +02:00 committed by Jan De Dobbeleer
parent c59c876b87
commit d6b56de4c1

View file

@ -37,6 +37,13 @@ New-Module -Name "oh-my-posh-core" -ScriptBlock {
[string[]]$Arguments = @()
)
if ($ExecutionContext.SessionState.LanguageMode -eq "ConstrainedLanguage") {
$_arguments = $Arguments -join ' '
$standardOut = Invoke-Expression "& $FileName $_arguments 2>&1"
$standardOut -join "`n"
return
}
$Process = New-Object System.Diagnostics.Process
$StartInfo = $Process.StartInfo
$StartInfo.FileName = $FileName