2 ms·
And note that isatty() works on a file descriptor, and that you might be outputting to both stderr and stdout, and both, neither, or some weird combination migh
by deathanatos 9y ago
And note that isatty() works on a file descriptor, and that you might be outputting to both stderr and stdout, and both, neither, or some weird combination might be a tty. (i.e., you need to check for the file descriptor you're going to output to.)
Some programs will check if stdout is a tty prior to writing to stderr, for example, which means that if you're doing,
foo | bar
foo's stderr will go to the tty, but would lose coloring, for example.
For example, `babel`, a JS transpiler, loses the color in its error messages when you pipe its output.