Co-authored-by: Daniel Jurek <djurek@microsoft.com>
This commit is contained in:
Azure SDK Bot 2025-10-03 16:13:55 -07:00 committed by GitHub
parent 524d7bc15f
commit 6f29059ce9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -54,6 +54,15 @@ function Invoke-LoggedCommand
if($LastExitCode -notin $AllowedExitCodes)
{
LogError "Command failed to execute ($duration): $Command`n"
# This fix reproduces behavior that existed before
# https://github.com/Azure/azure-sdk-tools/pull/12235
# Before that change, if a command failed Write-Error was always
# invoked in the failure case. Today, LogError only does Write-Error
# when running locally (not in a CI environment)
if ((Test-SupportsDevOpsLogging) -or (Test-SupportsGitHubLogging)) {
Write-Error "Command failed to execute ($duration): $Command`n"
}
}
else {
Write-Host "Command succeeded ($duration)`n"