Cargo: malformed formatting for nontty environments

Hi,

cargo update, cargo audit, and other cargo commands force terminal escape sequences in nontty environments, such as redirection to a file (cargo update >log.txt 2>&1, as well as piping (cargo update | less). This results in noisy text that is unnecessarily more difficult to read.

As a workaround, I have to set the environment variable CARGO_TERM_COLOR to never.

This is one anti-feature that I didn't want cargo to copy from NPM.

1 Like

Instead of setting the CARGO_TERM_COLOR environment variable, you can configure Cargo via a configuration file (using the term.color field in this case).