Setting the TERM environment variable to 'dumb' doesn't prevent use of VT (ANSI) escape sequences by the formatting system · Issue #16059 · PowerShell/PowerShell · GitHub
Skip to content

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

Closed

Description

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

Activity

  1. rkeithhill commented on Oct 28, 2021

    @rkeithhill
    Collaborator

    I think this is fixed in rc.1. Also note, that I invoke pwsh-preview here instead of pwsh which on my ubuntu is 7.0.0.

    image

    I see this code was added a few months ago:

  2. iSazonov commented on Oct 28, 2021

    @iSazonov
    Collaborator

    It was fixed in Preview.5 as experimental feature.

  3. ghost closed this as completedon Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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