Skip to content

Containers: PSSTYLE is a royal pain. Can we use environment variables for configuration? #14964

Closed

Description

@Jaykul

We really need a way to control PowerShell's configuration from outside a container.

Really, PowerShell should obviously respect ENVIRONMENT variables like TERM=dumb or NO_COLOR that we can set globally, and which we can pass into a docker container.

It needs to be something I can set when I'm not calling PowerShell directly, and ideally which works with existing containers, so I don't have to try to mount a system profile.ps1 into every different container we use...

Right now I have a docker container where PowerShell is being run with -NonInteractive but whenever there's an error it spews a bunch of [96m and [91m and so on...

image

While we're talking about it, I also want to turn off Progress output with an environment variable too, because the output in that screenshot is really weird.

Having to reach into a docker container and create a global profile to disable color isn't really a good solution.

Activity

  1. added
    Issue-Enhancement
    Needs-Triage
    on Mar 8, 2021
  2. SteveL-MSFT commented on Mar 8, 2021

    @SteveL-MSFT
    Member

    ANSI is currently controlled based on whether SupportsVirtualTerminal is true. Unfortunately, on UNIX, we always return true. We should probably at least respect TERM=dumb to set SupportsVirtualTerminal to false (which affects more than just color) and TERM=xterm-mono to set SupportsVirtualTerminal to true, but $PSStyle.Output='plaintext'

  3. added
    WG-Interactive-Console
    and removed
    Needs-Triage
    on Mar 8, 2021
  4. mklement0 commented on Mar 9, 2021

    @mklement0
    Contributor

    Steve Lee (@SteveL-MSFT), perhaps we can also revisit the idea of a new CLI parameter that controls the behavior:

    To quote you from #10811 (comment):

    Jason Shirk (@lzybkr) had a good suggestion to have a param on pwsh like -color with always, auto, never values.

  5. SteveL-MSFT commented on Mar 11, 2021

    @SteveL-MSFT
    Member

    Michael Klement (@mklement0) I had forgotten about that. Certainly, a new pwsh param that maps to OutputRendering would make sense and would override the env var

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

Metadata

Metadata

Labels

Issue-EnhancementWG-Interactive-Console

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions