mirror of
https://github.com/zebrajr/node.git
synced 2025-12-06 00:20:08 +01:00
tty: treat empty NO_COLOR same as absent NO_COLOR
PR-URL: https://github.com/nodejs/node/pull/58074 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
98da424ac4
commit
afbf2f385a
|
|
@ -99,9 +99,9 @@ function warnOnDeactivatedColors(env) {
|
||||||
if (warned)
|
if (warned)
|
||||||
return;
|
return;
|
||||||
let name = '';
|
let name = '';
|
||||||
if (env.NODE_DISABLE_COLORS !== undefined)
|
if (env.NODE_DISABLE_COLORS !== undefined && env.NODE_DISABLE_COLORS !== '')
|
||||||
name = 'NODE_DISABLE_COLORS';
|
name = 'NODE_DISABLE_COLORS';
|
||||||
if (env.NO_COLOR !== undefined) {
|
if (env.NO_COLOR !== undefined && env.NO_COLOR !== '') {
|
||||||
if (name !== '') {
|
if (name !== '') {
|
||||||
name += "' and '";
|
name += "' and '";
|
||||||
}
|
}
|
||||||
|
|
@ -141,9 +141,9 @@ function getColorDepth(env = process.env) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (env.NODE_DISABLE_COLORS !== undefined ||
|
if ((env.NODE_DISABLE_COLORS !== undefined && env.NODE_DISABLE_COLORS !== '') ||
|
||||||
// See https://no-color.org/
|
// See https://no-color.org/
|
||||||
env.NO_COLOR !== undefined ||
|
(env.NO_COLOR !== undefined && env.NO_COLOR !== '') ||
|
||||||
// The "dumb" special terminal, as defined by terminfo, doesn't support
|
// The "dumb" special terminal, as defined by terminfo, doesn't support
|
||||||
// ANSI color control codes.
|
// ANSI color control codes.
|
||||||
// See https://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials
|
// See https://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,13 @@ const writeStream = new WriteStream(fd);
|
||||||
[{ TERM: 'ansi' }, 4],
|
[{ TERM: 'ansi' }, 4],
|
||||||
[{ TERM: 'ANSI' }, 4],
|
[{ TERM: 'ANSI' }, 4],
|
||||||
[{ TERM: 'color' }, 4],
|
[{ TERM: 'color' }, 4],
|
||||||
|
[{ TERM: 'linux' }, 4],
|
||||||
|
[{ TERM: 'fail' }, 1],
|
||||||
|
[{ TERM: 'color', NO_COLOR: '' }, 4],
|
||||||
|
[{ TERM: 'color', NODE_DISABLE_COLORS: '' }, 4],
|
||||||
[{ TERM: 'color', NODE_DISABLE_COLORS: '1' }, 1],
|
[{ TERM: 'color', NODE_DISABLE_COLORS: '1' }, 1],
|
||||||
|
[{ TERM: 'color', NODE_DISABLE_COLORS: 0 }, 1],
|
||||||
|
[{ TERM: 'color', NODE_DISABLE_COLORS: null }, 1],
|
||||||
[{ TERM: 'console' }, 4],
|
[{ TERM: 'console' }, 4],
|
||||||
[{ TERM: 'direct' }, 4],
|
[{ TERM: 'direct' }, 4],
|
||||||
[{ TERM: 'dumb' }, 1],
|
[{ TERM: 'dumb' }, 1],
|
||||||
|
|
@ -78,7 +84,9 @@ const writeStream = new WriteStream(fd);
|
||||||
[{ NO_COLOR: '1', FORCE_COLOR: '2' }, 8],
|
[{ NO_COLOR: '1', FORCE_COLOR: '2' }, 8],
|
||||||
[{ NODE_DISABLE_COLORS: '1', FORCE_COLOR: '3' }, 24],
|
[{ NODE_DISABLE_COLORS: '1', FORCE_COLOR: '3' }, 24],
|
||||||
[{ NO_COLOR: '1', COLORTERM: '24bit' }, 1],
|
[{ NO_COLOR: '1', COLORTERM: '24bit' }, 1],
|
||||||
[{ NO_COLOR: '', COLORTERM: '24bit' }, 1],
|
[{ NO_COLOR: '', COLORTERM: '24bit' }, 24],
|
||||||
|
[{ NO_COLOR: null, COLORTERM: '24bit' }, 1],
|
||||||
|
[{ NO_COLOR: 0, COLORTERM: '24bit' }, 1],
|
||||||
[{ TMUX: '1', FORCE_COLOR: 0 }, 1],
|
[{ TMUX: '1', FORCE_COLOR: 0 }, 1],
|
||||||
[{ NO_COLOR: 'true', FORCE_COLOR: 0, COLORTERM: 'truecolor' }, 1],
|
[{ NO_COLOR: 'true', FORCE_COLOR: 0, COLORTERM: 'truecolor' }, 1],
|
||||||
[{ TERM: 'xterm-256color', COLORTERM: 'truecolor' }, 24],
|
[{ TERM: 'xterm-256color', COLORTERM: 'truecolor' }, 24],
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user