repl: don't use tty control codes when $TERM is set to "dumb"

This change stops the REPL from using ANSI control codes for colours
when the TERM environment variable is set to "dumb".

"dumb" is the terminal type with the smallest set of capabilities as
described by terminfo. See:

http://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials

Related: https://github.com/nodejs/node-v0.x-archive/issues/5344
Related: https://github.com/nodejs/node-v0.x-archive/pull/25506
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
PR-URL: https://github.com/nodejs/node/pull/2712
This commit is contained in:
Salman Aljammaz authored and Roman Reiss committed 2015-09-22 19:38:46 +02:00
1 parent 79d2c4e1bf
commit ccea33df62
2 files changed
+59 -1

No files matched your search

+4 -1
View File
@@ -34,7 +34,10 @@ function createRepl(env, opts, cb) {
if (parseInt(env.NODE_NO_READLINE)) {
opts.terminal = false;
}
if (parseInt(env.NODE_DISABLE_COLORS)) {
// the "dumb" special terminal, as defined by terminfo, doesn't support
// ANSI colour control codes.
// see http://invisible-island.net/ncurses/terminfo.ti.html#toc-_Specials
if (parseInt(env.NODE_DISABLE_COLORS) || env.TERM === 'dumb') {
opts.useColors = false;
}