Export disableColors from repl, share with debugger

This commit is contained in:
Fedor Indutny 2011-09-27 11:57:30 +02:00 committed by Bert Belder
parent f4124e18cb
commit 67706b8bb7
2 changed files with 4 additions and 4 deletions

View File

@ -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');
}

View File

@ -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);