-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest released version
- Search the existing issues.
- Refer to the FAQ.
- Refer to Differences between Windows PowerShell 5.1 and PowerShell.
Steps to reproduce
Running powershell scripts in Azure DevOps agent, by turning on the "Use PowerShell Core" option. Even though Azure DevOps is unable to display ansi colors, pwsh still prints them into the logs. If environment variable NO_COLOR is assigned, it reduces the amount of ansi colors printed.
This is probably the exact same issue as mentioned here closed few weeks ago: #19188
Expected behavior
Expected to see clear output without ANSI colors messing up the whole thing generally in Azure DevOps because it is unable to render them. If that's not possible to do by default, at least when NO_COLOR is specified.Actual behavior
Dir by default:
2023-07-13T06:42:19.8478852Z Directory: D:\DevOpsAgent\_work\r5\a\BuildTools
2023-07-13T06:42:19.8478970Z
2023-07-13T06:42:19.8480977Z �[32;1mMode LastWriteTime Length Name�[0m
2023-07-13T06:42:19.8481434Z �[32;1m---- ------------- ------ ----�[0mDir fixed when NO_COLOR defined:
2023-07-13T06:54:04.2713978Z Directory: D:\DevOpsAgent\_work\r5\a\BuildTools
2023-07-13T06:54:04.2714057Z
2023-07-13T06:54:04.2852758Z Mode LastWriteTime Length Name
2023-07-13T06:54:04.2854940Z ---- ------------- ------ ----
Looks ok so far, but then if an error happens:
2023-07-13T08:03:54.6876706Z �[31;1mCheck the spelling of the name, or if a path was included, verify that the path is correct and try again.�[0m
2023-07-13T08:03:54.6877395Z �[31;1mAt D:\DevOpsAgent\_work\_temp\5505d246-fe88-4efd-b7fb-ccb93a66f2cb.ps1:9 char:3�[0m
When environment variable __SuppressAnsiEscapeSequences defined, then this is fixed too:
2023-07-13T08:08:11.1173976Z Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2023-07-13T08:08:11.1175015Z At D:\DevOpsAgent\_work\_temp\f49db8aa-a65b-4b52-bccc-839d8d14f63f.ps1:9 char:3
### Error details
_No response_
### Environment data
```powershell
Name Value
---- -----
PSVersion 7.3.5
PSEdition Core
GitCommitId 7.3.5
OS Microsoft Windows 10.0.20348
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Visuals
No response
Adam-S-Daniel, mklement0 and dw-alexangas
Metadata
Metadata
Assignees
Labels
In-PRIndicates that a PR is out for the issueIndicates that a PR is out for the issueIssue-BugIssue has been identified as a bug in the productIssue has been identified as a bug in the productWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtime