fix(pwsh): wrap module code in try-catch blocks

relates to #5348
This commit is contained in:
Jan De Dobbeleer 2024-07-26 07:05:06 +02:00 committed by Jan De Dobbeleer
parent 34e8154b71
commit 00260e1c72

View file

@ -376,12 +376,18 @@ Example:
}
if ($global:_ompAzure) {
$env:POSH_AZURE_SUBSCRIPTION = Get-AzContext | ConvertTo-Json
try {
$env:POSH_AZURE_SUBSCRIPTION = Get-AzContext | ConvertTo-Json
}
catch {}
}
if ($global:_ompPoshGit) {
$global:GitStatus = Get-GitStatus
$env:POSH_GIT_STATUS = $global:GitStatus | ConvertTo-Json
try {
$global:GitStatus = Get-GitStatus
$env:POSH_GIT_STATUS = $global:GitStatus | ConvertTo-Json
}
catch {}
}
Set-PoshContext