summaryrefslogtreecommitdiff
path: root/lib/internal/repl.js
diff options
context:
space:
mode:
authorSalman Aljammaz <s@0x65.net>2015-09-05 18:03:46 +0300
committerRoman Reiss <me@silverwind.io>2015-09-22 19:38:46 +0200
commitccea33df6262e82503942dfdbe45e7baade89caa (patch)
treeb481f8e6ed06fe2fea3c6a6ddfc8cf1de7e8ce73 /lib/internal/repl.js
parent79d2c4e1bf13f81af62d6eb2228bb988f709b1f9 (diff)
downloadandroid-node-v8-ccea33df6262e82503942dfdbe45e7baade89caa.tar.gz
android-node-v8-ccea33df6262e82503942dfdbe45e7baade89caa.tar.bz2
android-node-v8-ccea33df6262e82503942dfdbe45e7baade89caa.zip
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
Diffstat (limited to 'lib/internal/repl.js')
-rw-r--r--lib/internal/repl.js5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/internal/repl.js b/lib/internal/repl.js
index b2c74e179c..c1beb85cef 100644
--- a/lib/internal/repl.js
+++ b/lib/internal/repl.js
@@ -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;
}