feat(pwsh): move Set-PoshContext to global variable scope

resolves #1988
This commit is contained in:
Jan De Dobbeleer 2022-03-27 09:58:29 +02:00 committed by Jan De Dobbeleer
parent 13aa6c2b99
commit 5711e431a4

View file

@ -74,7 +74,6 @@ function global:Initialize-ModuleSupport {
}
$global:OMP_ERRORCODE = 0
Initialize-ModuleSupport
Set-PoshContext
if ($lastCommandSuccess -eq $false) {
#native app exit code
if ($realLASTEXITCODE -is [int] -and $realLASTEXITCODE -gt 0) {
@ -100,6 +99,7 @@ function global:Initialize-ModuleSupport {
$global:OMP_EXECUTIONTIME = ($history.EndExecutionTime - $history.StartExecutionTime).TotalMilliseconds
$global:omp_lastHistoryId = $history.Id
}
Set-PoshContext
$terminalWidth = $Host.UI.RawUI.WindowSize.Width
$standardOut = @(&$omp print primary --error="$global:OMP_ERRORCODE" --pwd="$cleanPWD" --pswd="$cleanPSWD" --execution-time="$global:OMP_EXECUTIONTIME" --stack-count="$stackCount" --config="$config" --terminal-width=$terminalWidth 2>&1)
# make sure PSReadLine knows we have a multiline prompt