diff --git a/lib/_debugger.js b/lib/_debugger.js index c3803911dc1..baec92900c5 100644 --- a/lib/_debugger.js +++ b/lib/_debugger.js @@ -670,7 +670,7 @@ function SourceUnderline(sourceText, position, tty) { tail = sourceText.slice(position); // Colourize char if stdout supports colours - if (tty) { + if (tty && !repl.disableColors) { tail = tail.replace(/(.+?)([^\w]|$)/, '\033[32m$1\033[39m$2'); } diff --git a/lib/repl.js b/lib/repl.js index 915afcda749..23188e2bd31 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -56,9 +56,9 @@ function hasOwnProperty(obj, prop) { var context; -var disableColors = true; +exports.disableColors = true; if (process.platform != 'win32') { - disableColors = process.env.NODE_DISABLE_COLORS ? true : false; + exports.disableColors = process.env.NODE_DISABLE_COLORS ? true : false; } @@ -114,7 +114,7 @@ function REPLServer(prompt, stream, eval) { this.commands = {}; defineDefaultCommands(this); - if (rli.enabled && !disableColors && exports.writer === util.inspect) { + if (rli.enabled && !exports.disableColors && exports.writer === util.inspect) { // Turn on ANSI coloring. exports.writer = function(obj, showHidden, depth) { return util.inspect(obj, showHidden, depth, true);