Skip to content

Cargo display color codes on terminals (TERM) without color support #11211

Open
@amarao

Description

@amarao

Problem

Some terminals lack ability to display colors. If TERM is set to the terminal type without color support, cargo should not put random (other terminal codes) on the screen.

Steps

  1. TERM=t10 cargo build

Expected result: no color codes.
Actual result: color console codes in output.

Possible Solution(s)

Unknown terminal types should switch cargo into 'no colors' mode.

Notes

infocmp t10
#	Reconstructed via infocmp from file: /usr/share/terminfo/t/t10
t10|Teleray 10 special,
	km, xhp, xt,
	cols#80, it#8, lines#24, xmc#2,
	clear=\Ej$<30/>, cub1=^H, cud1=\EB, cuf1=\EC,
	cup=\EY%p1%' '%+%c%p2%' '%+%c, cuu1=\EA, dch1=\EQ,
	dl1=\EM, ed=\EJ, el=\EK, home=\EH, ht=^I, ich1=\EP, il1=\EL,
	ind=\Eq, pad=\0, ri=\Ep, rmso=\ER@, rmul=\ER@, smso=\ERD,
	smul=\ERH,

Version

cargo 1.63.0 (fd9c4297c 2022-07-01)
release: 1.63.0
commit-hash: fd9c4297ccbee36d39e9a79067edab0b614edb5a
commit-date: 2022-07-01
host: x86_64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.83.1-DEV (sys:0.4.55+curl-7.83.1 vendored ssl:OpenSSL/1.1.1n)
os: Ubuntu 22.10 (kinetic) [64-bit]

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-console-outputArea: Terminal output, colors, progress bar, etc.C-bugCategory: bugS-blocked-externalStatus: ❌ blocked on something out of the direct control of the Cargo project, e.g., upstream fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions