Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Export disableColors from repl, share with debugger
Browse files Browse the repository at this point in the history
  • Loading branch information
indutny authored and piscisaureus committed Sep 27, 2011
1 parent f4124e1 commit 67706b8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/_debugger.js
Expand Up @@ -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');
}

Expand Down
6 changes: 3 additions & 3 deletions lib/repl.js
Expand Up @@ -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;
}


Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 67706b8

Please sign in to comment.