Skip to content

Setting the TERM environment variable to 'dumb' doesn't prevent use of VT (ANSI) escape sequences by the formatting system #16059

@mklement0

Description

@mklement0

Prerequisites

Steps to reproduce

Related: #14594 and #16060

While setting the TERM environment variable to 'dumb' does make $host.UI.SupportsVirtualTerminal report $false, the output-formatting system still uses VT (ANSI) escape sequences and produces colored output.

Note: Unlike setting TERM to xtermm / xterm-mono, dumb does not cause $PSStyle.OutputRendering to reflect PlainText (arguably, if PowerShell knows that the terminal doesn't support VT (ANSI) escape sequences, it shouldn't use them, irrespective of the value of $PSStyle.OutputRendering).

# On Unix
sh -c 'TERM=dumb pwsh -c ''Get-Item /'''

Expected behavior

The output shouldn't be colored.

Actual behavior

The output is colored.

Note: On Windows, the equivalent $env:TERM='dumb'; pwsh -nop -c 'Get-Item /' command doesn't render the colors, but outputs the escape sequences as-is, with the ESC char. represented as

Error details

No response

Environment data

PowerShell Core 7.2.0-preview.9

Visuals

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions