Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turn off supervisor log coloring in local windows studio if ANSI is not supported #6306

Merged
merged 1 commit into from
Mar 18, 2019

Conversation

mwrock
Copy link
Contributor

@mwrock mwrock commented Mar 16, 2019

On Windows versions prior to 10.0.10586(TH2), the standard windows console did not understand ANSI code sequences. While we have adopted the termcolor crate to use console APIs instead of ANSI sequences on Windows, termcolor will fall back to ansi if it cannot find a console. This will happen if habitat is running in a headless environment like a windows service or in a local studio where we launch it in the background.

We already specify --no-color as a default parameter in the windows-service but the local studio should turn off color if runing in a older version of windows like 2012R2 or even an earlier 2016 build.

This sniffs the OS version and adds --no-color and also sets HAB_NOCOLORING on non ANSI supporting versions:

BEFORE:
image

AFTER:
image

Signed-off-by: mwrock matt@mattwrock.com

…ot supported

Signed-off-by: mwrock <matt@mattwrock.com>
@thesentinels
Copy link
Contributor

Thanks for the pull request! Here is what will happen next:

  1. Your PR will be reviewed by the maintainers
  2. If everything looks good, one of them will approve it, and your PR will be merged.

Thank you for contributing!

@mwrock mwrock changed the title turn off supervisor log coloring in local windows studio in ANSI is not supported turn off supervisor log coloring in local windows studio if ANSI is not supported Mar 16, 2019
Copy link
Contributor

@baumanj baumanj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't grok all the powershell, but the logic looks sound

@mwrock mwrock merged commit 172645d into master Mar 18, 2019
@mwrock mwrock deleted the 2012_color branch March 18, 2019 18:28
chef-ci added a commit that referenced this pull request Mar 18, 2019
Obvious fix; these changes are the result of automation not creative thinking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants