From 6f29059ce9e91f2346e4880abb4f815ce649b4e3 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Fri, 3 Oct 2025 16:13:55 -0700 Subject: [PATCH] Revert behavior change introduced in https://github.com/Azure/azure-sdk-tools/pull/12235 (#6767) Co-authored-by: Daniel Jurek --- eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 b/eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 index 9475164a5..0c2431cc7 100644 --- a/eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 +++ b/eng/common/scripts/Helpers/CommandInvocation-Helpers.ps1 @@ -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"