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

Prints junk to screen in Windows Console (cmd.exe) #29

Open
coolaj86 opened this issue Sep 14, 2020 · 1 comment
Open

Prints junk to screen in Windows Console (cmd.exe) #29

coolaj86 opened this issue Sep 14, 2020 · 1 comment
Labels
good first issue Good for newcomers

Comments

@coolaj86
Copy link
Contributor

coolaj86 commented Sep 14, 2020

Re: @bitcrazed's comment #12 (comment):
Apparently Console can support colors, but we need a special syscall SetConsoleMode for Windows to do so.

I think Go's x/sys/windows package exposes the necessary GetConsoleMode and SetConsoleMode syscalls, so this should be doable.

Basic flow:

  1. GetConsoleMode
  2. OR with ENABLE_VIRTUAL_TERMINAL_PROCESSING
  3. SetConsoleMode
    • If ERROR, no color support => disable color
    • else, has color support

I probably won't get to this right away, but I've left enough info for someone else to be able to fix it if they have the time and inclination before I do.

@rs Want to tag with with Up For Grabs / Good First Issue? I think any Windows + Go developer should be able to handle this (and I can post it in the #golang Slack as well)

@rs
Copy link
Owner

rs commented Sep 14, 2020

Done

rs pushed a commit that referenced this issue Aug 9, 2021
For windows runtime, added originalMode or
ENABLE_VIRTUAL_TERMINAL_PROCESSING in SetConsoleMode, and if case of any
error, disabled color print.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants