I'm creating some pipes and handing it over to fork()/exec()'d child process as stdout and stderr FDs. But the child program doesn't output ANSI colours.

For e.g., the `gcc` command can output diagnostics with colours. But when I create it as a child of my program and hand over the piped FDs it doesn't send generate colours.

With a bit of snooping around, I found it tests `isatty(STDERR_FILENO)` and doesn't send ANSI colour codes when it returns false. Is there a way I can make my pipes be treated as TTYs in child process?

P.S. Also, please not I'm aware of `unbuffer` shell command which was recommended for similar question. I am looking for C/POSIX API solution that's portable across unices. Not just Linux.