Base.run and ansi colours

Hi,

Recently, ansi colours haven’t been working for me (using the git bash shell in VSCode). I thought it might be VSCode, but I’m starting to wonder if it’s Julia (I’m using 1.6.3). I think it might be related to Base.run:

$ julia -e 'println("\33[1;31mhello\33[0m")'
hello

(where the “hello” is in red)

but

$ julia -e 'run(`true`); println("\33[1;31mhello\33[0m")'
←[1;31mhello←[0m

It seems to be Julia, rather than git bash or VSCode which I originally suspected, because:

$ python -c "import os; os.system('true'); print('\33[1;31mhello\33[0m')"
hello

where, again, “hello” is in red.

Any ideas what I might be doing wrong? I couldn’t find any previous mention of the issue here or on github. Thanks!

1 Like

Hi,

I thought I’d give an update on this: it’s not fixed it 1.7.0 rc2. I also posted on Stackoverflow, and got a confirmation that I’m not the only one with this problem.

In summary, the problems seems to be that on some versions of windows, if you run a “git bash” command (eg /bin/true) from Julia with Base.run, you break subsequent terminal coloring.

  • The equivalent in Python doesn’t break coloring
  • coloring breaks in both git bash and cmd.exe shells
  • running a “windows” executable from Base.run does not break coloring
  • this doesn’t seem to happen for everyone, so it may be a windows version problem (I have Windows 10 19042)

I’d be grateful for any insight!

1 Like