Skip to content

Fix console color fallback handling for invalid host values#1168

Open
MJECloud wants to merge 1 commit into
microsoft:masterfrom
MJECloud:master
Open

Fix console color fallback handling for invalid host values#1168
MJECloud wants to merge 1 commit into
microsoft:masterfrom
MJECloud:master

Conversation

@MJECloud
Copy link
Copy Markdown

Description

Improve PowerShell logging color handling by adding a safe console color fallback path. This change validates host-provided color values and falls back to known defaults when values are invalid, preventing runtime failures when writing task issue and debug output.

Why?

Some Linux environments can return invalid console color values (for example -1), which caused task execution to fail when Write-Host received an unsupported color. This update makes logging resilient across platforms and avoids breaking pipelines due to host color metadata.

Related

microsoft/azure-pipelines-agent#5530

@MJECloud MJECloud requested review from a team as code owners April 18, 2026 22:00
@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines:
1 pipeline(s) require an authorized user to comment /azp run to run.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant