GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — No colors when hooks are run by a git commit · Issue #1381 · pre-commit/pre-commit

No colors when hooks are run by a git commit #1381

New issue
Copy link
New issue
Copy link
Closed
#1382
Closed
No colors when hooks are run by a git commit#1381
#1382
Copy link

Description

@Cielquan
Cielquan
opened on Apr 2, 2020
Issue body actions

Hi,
I use pre-commit at home on linux which works perfect. But at work I have a windows pc. Here I have problems with the colorfull output.

When the hooks are run by tox calling pre-commit run there are colors as usual. When the hooks are run by a git commit the colors are missing.

Concrete I mean the green for 'Passed', red for 'Failed ' and yellow/brown for 'Skipped' in the overview.

There is no difference if I run it via git-bash, cmd or powershell. Also there is no difference if I use the pycharm buildin terminal or others.

Activity

  1. asottile commented on Apr 2, 2020

    @asottile
    asottile
    on Apr 2, 2020
    Member
    More actions

    colors on windows are a bit fiddly and unfortunately there isn't much we can do to change them when run from git -- we try and call SetConsoleMode here but if that fails you don't get colors

  2. Cielquan commented on Apr 2, 2020

    @Cielquan
    Cielquan
    on Apr 2, 2020
    Author
    More actions

    Ok thanks for the fast answer.
    Then I have to live with it :(

  3. Cielquan
    closed this as completedon Apr 2, 2020
  4. asottile commented on Apr 2, 2020

    @asottile
    asottile
    on Apr 2, 2020
    Member
    More actions

    actually hmm, on windows sys.stdout.isatty() is false, but sys.stderr.isatty() is true -- which is different than linux, maybe if we use stderr instead of stdout?

  5. asottile
    reopened this on Apr 2, 2020
  6. Cielquan commented on Apr 2, 2020

    @Cielquan
    Cielquan
    on Apr 2, 2020
    Author
    More actions

    When I run sys.std---.isatty() on my windows maschine both are false when run from pycharm python console. But both are true when run from the terminal regardless if via invoking a python console first or by running python -c.

  7. asottile commented on Apr 2, 2020

    @asottile
    asottile
    on Apr 2, 2020
    Member
    More actions

    can you try the patch in #1382?

  8. Cielquan commented on Apr 2, 2020

    @Cielquan
    Cielquan
    on Apr 2, 2020
    Author
    More actions

    Sure let me try .. may take a bit.

  9. Cielquan commented on Apr 2, 2020

    @Cielquan
    Cielquan
    on Apr 2, 2020
    Author
    More actions

    It does work 👍

  10. asottile
    closed this as completedin #1382on Apr 2, 2020
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.