From 27edeedeaf5cc07a50d23bc96c20540d62cc4337 Mon Sep 17 00:00:00 2001 From: Jan De Dobbeleer Date: Sun, 10 Jul 2022 13:29:31 +0200 Subject: [PATCH] fix(pwsh): debug prompt logic resolves #2483 --- src/shell/scripts/omp.ps1 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/shell/scripts/omp.ps1 b/src/shell/scripts/omp.ps1 index 0d21c4d3..3d29fcc8 100644 --- a/src/shell/scripts/omp.ps1 +++ b/src/shell/scripts/omp.ps1 @@ -13,9 +13,6 @@ function global:Get-PoshStackCount { return 0 } -# See https://github.com/JanDeDobbeleer/oh-my-posh/discussions/1928 -function global:Test-PSDebugContext { return Test-Path Variable:/PSDebugContext } - New-Module -Name "oh-my-posh-core" -ScriptBlock { $script:ErrorCode = 0 $script:OMPExecutable = '::OMP::' @@ -268,7 +265,8 @@ Example: $script:TransientPrompt = $false return } - if (global:Test-PSDebugContext) { + # see https://github.com/JanDeDobbeleer/oh-my-posh/issues/2483#issuecomment-1175761456 + if ((Get-PSCallStack).Location[0] -ne "") { @(Start-Utf8Process $script:OMPExecutable @("print", "debug", "--pwd=$cleanPWD", "--pswd=$cleanPSWD", "--config=$env:POSH_THEME", "--shell=::SHELL::")) -join "`n" return }