From d6b56de4c1c39bc4aea1754483e4fe4fc11c1f4e Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sat, 25 Jun 2022 20:03:24 +0200 Subject: [PATCH] fix(pwsh): allow ConstrainedLanguage mode relates to #2369 --- src/shell/scripts/omp.ps1 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index cd186221..0d21c4d3 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -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