Skip to content

Disable color when stdout is piped or redirected #3635

@truthdoug

Description

@truthdoug

Many command line utilities (including ls, git, and jq) disable colors and other formatting when the output does not go to a tty. I'd like to see the heroku cli do this.

I like to run things like heroku logs > /tmp/myapp.log and open that in my editor. The color codes are noisy.

On the other hand, I rarely send the output of heroku ps to a pipe or a file. The colors help. Setting NO_COLOR=true for my shell disables that.

Detecting is done with process.stdout.isTTY (already in multiple locations in this repo)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions