logoalt Hacker News

zahlmanyesterday at 3:15 PM0 repliesview on HN

> I don't know how they detect that.

The OS knows (it has to because it set up the pipeline), and the process can find out through a system call, exposed in C as `isatty`: https://www.man7.org/linux/man-pages/man3/isatty.3.html

> This solution seems like it would fit the problem from the article?

Might not be a great idea. The world is probably already full of build tools pipelines that expect to process the normal terminal output (maybe with colours stripped). Environment variables like `CI` are a thing for a reason.