Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Streamed executable output prints Ansi Escaping in Write-* Commandlets #18771

Copy link
Copy link
@Herrmel

Description

@Herrmel
Issue body actions

Prerequisites

Steps to reproduce

When piping input of an application to an Commandlet like Write-Error the written content contains the ansi escaping signs.
For example the command:

dotnet --version | Write-Verbose -Verbose

Expected behavior

Printing the following output in yellow:

VERBOSE: 7.0.100

Actual behavior

The following Text is printed colorless:

�[33;1mVERBOSE: 7.0.100�[0m

Error details

If the output is intercepted with Out-String the output seems to work correctly unless the Parameter -Stream is used. Seems like the Encoding is only broken when the text is returned as a stream down the pipline instead of at the end of the command.

For some very odd reason after I type an incorrect parameter like this:

dotnet --version | Write-Verbose -u # -u does not exist

The error-message is again displayed with ansi escape signs, but afterwards everything works as expected when I use the previous command again.

Environment data

Name                           Value
----                           -----
PSVersion                      7.3.0
PSEdition                      Core
GitCommitId                    7.3.0
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Visuals

image

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution-ExternalThe issue is caused by external component(s).The issue is caused by external component(s).

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.