rustc: Disable color codes in non-tty terminal environments

ea95ff9
Opened by Andrew at 2022-05-15 16:39:29

When rustc is invoked from non-tty shell contexts, such as being piped to less rustc ... | less, or when rustc is run from an Emacs or Vim terminal, then terminal codes like $<2> should not be emitted on compiler messages.

  1. On linux, I can't find an old release of rustc that sent ANSI coloring escape codes when its output wasn't a TTY. I think this old issue can be closed.

    Andrew Chin at 2020-11-27 19:27:17

  2. For me echo | rustc - | less shows colors.

    bjorn3 at 2022-05-15 16:39:29