emacs-eldev / eldev

Elisp development tool
https://emacs-eldev.github.io/eldev/
GNU General Public License v3.0
226 stars 17 forks source link

Keep colors through docker output (useful for test output, green vs red) #86

Closed Trevoke closed 1 year ago

Trevoke commented 1 year ago

If I understand correctly, we can pass an additional option to the docker container to let it print colors properly:

https://stackoverflow.com/a/33499558/234025

docker run --rm -it -e "TERM=xterm-256color" govim bash -l

I tried to extend Eldev-local like so but didn't get any success:

(setq eldev-docker-executable "podman"
      eldev-docker-run-extra-args '("--userns=keep-id" "--env=\"TERM=xterm-256color\""))
doublep commented 1 year ago

Trivial reproducer:

$ eldev exec '(eldev-warn "test")' # -> colored
$ eldev docker 27 exec '(eldev-warn "test")' # -> not colored

You can work around this by passing global option -C via command docker:

$ eldev docker 27 -C exec '(eldev-warn "test")' # -> colored

However, please don't close this, it has to be automatic. I.e. if the outer process uses colored output, the one running in Docker should do that too, because they write to the same terminal.

doublep commented 1 year ago

Will become automatic in 1.4, for now you can use the workaround.