curlie icon indicating copy to clipboard operation
curlie copied to clipboard

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

Open coolaj86 opened this issue 5 years ago • 1 comments

Re: @bitcrazed's comment https://github.com/rs/curlie/issues/12#issuecomment-692194493: 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.

  • https://godoc.org/golang.org/x/sys/windows#SetConsoleMode
  • https://godoc.org/golang.org/x/sys/windows#GetConsoleMode

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)

coolaj86 avatar Sep 14 '20 17:09 coolaj86

Done

rs avatar Sep 14 '20 22:09 rs