No colors in compiler output when using concurrently

Anyone know the reason why rescript has no colors when running from a concurrently script?

Because it sees that the output target is no longer a user terminal (TTY) but a pipe: to a file, to some weird program, who knows…

You can force it to output colors by setting NINJA_ANSI_FORCED environment var to 1.

Here is a snippet from my Makefile:

BSB := yarn bsb
BSB_FORCE_COLOR := NINJA_ANSI_FORCED=1 $(BSB)
NEXT := yarn next

#...

.PHONY: dev
dev:
	yarn concurrently \
	  --names "rescript,next----" \
	  --kill-others \
	  "$(BSB_FORCE_COLOR) -clean -make-world -w" \
	  "$(NEXT) dev --port 7700"

¹ bsb is an older rescript. I’m not on the latest version still in this project.

5 Likes