clarinet icon indicating copy to clipboard operation
clarinet copied to clipboard

Colors on Windows Bash

Open obycode opened this issue 3 years ago • 5 comments

When running clarinet on Windows in a bash terminal (Git Bash), I am seeing the escape codes instead of the colors:

$ clarinet check
←[1;31merror←[0m: use of unresolved function 'addx'
←[1;36m-->←[0m contracts/foo.clar:22:4
  (begin
   ^~~~~
    (print (addx 3 4))
    ^~~~~~~~~~~~~~~~~~
    (print (set-my-var 7))
    ^~~~~~~~~~~~~~~~~~~~~~
    ^~~~~~~~~~~~~~~~~~~~~~
    (unwrap! (contract-call? .bar do-something (var-get myVar)) (err u100))     
    ^~~~~~~~~~~~~~~~~~~~~~
    (unwrap! (contract-call? .bar do-something (var-get myVar)) (err u100))
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    (contract-call? b do-something 42)
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

←[1;31mx←[0m 1 error detected

←[1;33m----------------------------←[0m
←[1;33mHint: what's next?←[0m
←[1;33mOnce you are ready to write TypeScript unit tests for your contract, run the following command:
←[0m
←[1;36m  $ clarinet test←[0m
←[1;33m    Run all run tests in the ./tests folder.
←[0m
←[1;33mFind more information on testing with Clarinet here: https://docs.hiro.so/smart-contracts/clarinet#testing-with-the-test-harness←[0m
←[1;33mDisable these hints with the env var CLARINET_DISABLE_HINTS=1←[0m
←[1;33m----------------------------←[0m

The colors work as expected in Powershell and Command Prompt.

obycode avatar May 24 '22 17:05 obycode

A user posted a screenshot on Discord showing this same problem in Powershell.

image

obycode avatar May 31 '22 14:05 obycode

It also seems that the colors work in cmd within VSCode, but not in a standalone cmd window.

obycode avatar Aug 18 '22 16:08 obycode

Can you run Git Bash manually1 and change the active codepage to UTF-8?


1By manually, I mean:

  1. Execute cmd.exe via C:\Windows\system32\cmd.exe
  2. Execute C:\<your_git_path>\git-cmd.exe --no-cd --command=usr/bin/bash.exe -l -i
  3. Execute (now you should be in 'Git Bash') chcp.com 65001
  4. Try running clarinet check and see if that makes any difference.

moodmosaic avatar Sep 02 '22 10:09 moodmosaic

I also experienced this issue, and adding chcp.com 65001 to my .bashrc fixed it :)

cylewitruk avatar Nov 03 '22 14:11 cylewitruk

Great!

moodmosaic avatar Nov 03 '22 15:11 moodmosaic