Skip to content

Commit 404434e

Browse files
redirect stderr to $null
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent c280c55 commit 404434e

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

tracer/tools/AzureDevOpsHelpers.psm1

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -203,27 +203,19 @@ Azure CLI (az) not found.
203203

204204
if ($hasAz) {
205205
# 2. azure-devops extension installed
206-
$stderrFile = [System.IO.Path]::GetTempFileName()
207-
try {
208-
$null = & az extension show --name azure-devops 2>$stderrFile
209-
if ($LASTEXITCODE -ne 0) {
210-
$errors += @"
206+
$null = & az extension show --name azure-devops 2>$null
207+
if ($LASTEXITCODE -ne 0) {
208+
$errors += @"
211209
Azure CLI 'azure-devops' extension not found.
212210
Install with: az extension add --name azure-devops
213211
"@
214-
}
215-
}
216-
finally {
217-
Remove-Item -Path $stderrFile -Force -ErrorAction SilentlyContinue
218212
}
219213

220214
# 3. Azure CLI authenticated
221-
$stderrFile = [System.IO.Path]::GetTempFileName()
222215
$accountOutput = $null
223-
try {
224-
$accountOutput = & az account show --output json 2>$stderrFile
225-
if ($LASTEXITCODE -ne 0) {
226-
$errors += @"
216+
$accountOutput = & az account show --output json 2>$null
217+
if ($LASTEXITCODE -ne 0) {
218+
$errors += @"
227219
Azure CLI is not logged in.
228220
Run: az login
229221
For MFA-enabled tenants: az login --tenant <TENANT_ID> --use-device-code

0 commit comments

Comments
 (0)