clarinet
clarinet copied to clipboard
Colors on Windows Bash
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.
A user posted a screenshot on Discord showing this same problem in Powershell.

It also seems that the colors work in cmd within VSCode, but not in a standalone cmd window.
Can you run Git Bash manually1 and change the active codepage to UTF-8?
1By manually, I mean:
- Execute
cmd.exevia C:\Windows\system32\cmd.exe - Execute
C:\<your_git_path>\git-cmd.exe --no-cd --command=usr/bin/bash.exe -l -i - Execute (now you should be in 'Git Bash')
chcp.com 65001 - Try running
clarinet checkand see if that makes any difference.
I also experienced this issue, and adding chcp.com 65001 to my .bashrc fixed it :)
Great!